timeinc / tealium
Tealium Implementation for PHP
Installs: 4 950
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 8
Forks: 1
Open Issues: 0
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-11-07 00:58:22 UTC
README
This package provides Tealium integration for PHP, handling script generation and Universal Data Object (UDO) control.
Implementations
Installation
Composer
composer require timeinc/tealium
Usage
PHP
<?php use TimeInc\Tealium\Tealium; use TimeInc\Tealium\Udo; $udo = new Udo(); // use $udo->properties to add data to the UDO object $udo->properties['site'] = 'My Site'; $tealium = new Tealium('org', 'app', $udo, Tealium::TEALIUM_PROD);
Template
To render Tealium onto the page, use the tealium()
twig function:
<html> <head> </head> <body> <script type="text/javascript"> var <?php $udo->getName(); ?> = <?php echo (string) $udo ?>; </script> <script type="text/javascript"> (function(a,b,c,d){ a='//tags.tiqcdn.com/utag/<?php echo $tealium->getOrganisation() ?>/<?php echo $tealium->getApp() ?>/<?php echo $tealium->getEnvironment() ?>/utag.js'; b=document;c='script';d=b.createElement(c);d.src=a;d.type='text/java'+c;d.async=true; a=b.getElementsByTagName(c)[0];a.parentNode.insertBefore(d,a); })(); </script> </body> </html>