1001pharmacies / tagcommander-bundle
This package's canonical repository appears to be gone and the package has been frozen as a result.
Installs: 990
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 11
Forks: 5
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=5.3.3
- symfony/serializer: ^2.7
Requires (Dev)
- phing/phing: ~2.9
- phpunit/phpunit: 4.*
- sebastian/phpcpd: 2.*
- squizlabs/php_codesniffer: 1.*
- symfony/symfony: 2.3.*
This package is not auto-updated.
Last update: 2021-01-09 00:21:57 UTC
README
Provides a Symfony tool pack to easily integrates TagCommander into your application.
Data from your TagCommander datalayer, containers and events will be visible in your Symfony's debug toolbar and profiler.
Installation
Install the package with Composer :
composer require 1001pharmacies/tagcommander-bundle
Update app/AppKernel.php
:
$bundles = array( // ... new Meup\Bundle\TagcommanderBundle\MeupTagcommanderBundle(), );
Setup your app/config/config.yml
meup_tagcommander: default_event: "default" datalayer: name: "tc_vars" default: { env: "%kernel.environment%", locale: "%locale%" } containers: - { name: "ab-test", script: "my-ab-test-container.js" } - { name: "generic", script: "my-generic-container.js", version: "v17.11", alternative: "//redirect1578.tagcommander.com/utils/noscript.php?id=3&mode=iframe" } events: - { name: "default", function: "tc_events_1" } - { name: "other_events", function: "tc_events_2" }
The meup_tagcommander.datalayer.default
config node allows you to pre-fill your datalayer directly from your your config tree.
Then update your pages to track events :
<html> <head> {% block head_javascript %} {{ tc_vars({ 'route': app.request.attributes.get('_route') }) }} {{ tc_container("ab-test") }} {% endblock %} </head> <body> <!-- simple tracking sample --> <a href="#" onclick="javascript: return {{ tc_event('lorem_click') }}">lorem ipsum</a> <!-- advanced tracking sample --> <img src="sample.jpg" onmouseover="javascript: return {{ tc_event('over_image', {'src': 'sample.jpg'}, 'other_events') }}"> <!-- rendering tag commander containers --> {% block body_javascript %} {{ tc_container("generic") }} {% endblock %} </body> </html>
Using tc_datalayer
service
$datalayer = $container->get('tc_datalayer');
$datalayer->set('foo', 'bar');
var_dump($datalayer->all());