timeinc / tealium-bundle
Symfony 的 Tealium 实现
1.0.0
2016-03-22 10:46 UTC
Requires
- symfony/config: ~2.0|~3.0
- symfony/dependency-injection: ~2.0|~3.0
- symfony/http-kernel: ~2.0|~3.0
- timeinc/tealium: ~1.0
- twig/twig: ^1.24
Requires (Dev)
- leaphub/phpcs-symfony2-standard: ~2.0
- pdepend/pdepend: ~2.0
- phpmd/phpmd: ~2.2
- phpunit/phpunit: ~4.8
- sebastian/phpcpd: ~2.0
- squizlabs/php_codesniffer: ~2.3
This package is not auto-updated.
Last update: 2024-09-20 21:58:27 UTC
README
此包提供了使用 timeinc/tealium
包对 Symfony2 和 Symfony3 进行 Tealium 集成的功能。
安装
Composer
composer require timeinc/tealium-bundle
在 AppKernel.php 中启用
$bundles = [ // ... new TimeInc\TealiumBundle\TimeIncTealiumBundle(), ];
配置
# app/config/config.yml time_inc_tealium: organisation: organisation-name # Required app: tealium-application # Required environment: prod udo: namespace: utag_data defaults: [] # Array of any variables to add as utag_data defaults
使用方法
控制器
要使用,请配置服务中的 UDO,您可以通过调用 timeinc.tealium
服务
<?php class DemoController extends Controller { public function demoAction(){ $tealium = $this->get('timeinc.tealium'); $udo = $tealium->getUdo(); // use $udo->properties to add data to the UDO object $udo->properties['site'] = 'My Site'; } }
Twig
要将 Tealium 渲染到页面上,使用 tealium()
twig 函数
<html> <head> </head> <body> {{ tealium() }} </body> </html>