timeinc/tealium-bundle

Tealium Implementation for Symfony

1.0.0 2016-03-22 10:46 UTC

This package is not auto-updated.

Last update: 2024-11-15 22:42:52 UTC


README

Build Status

This bundle provides Tealium integration for Symfony2 and Symfony3 using the timeinc/tealium package.

Installation

Composer

composer require timeinc/tealium-bundle

Enable in AppKernel.php

$bundles = [
    // ...
    new TimeInc\TealiumBundle\TimeIncTealiumBundle(),
];

Configuration

# 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

Usage

Controller

To use configure the UDO in the service, you can call the timeinc.tealium service:

<?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

To render Tealium onto the page, use the tealium() twig function:

<html>
    <head>
    </head>
    <body>
        {{ tealium() }}
    </body>
</html>