From 53557e01084d110b1f0b38513261c5021df3fc32 Mon Sep 17 00:00:00 2001 From: Amauri CHAMPEAUX Date: Thu, 19 Feb 2015 02:55:23 +0100 Subject: [PATCH] Google Tag Manager support --- tarteaucitron.services.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tarteaucitron.services.js b/tarteaucitron.services.js index 9d60bd3..8bb8fd7 100644 --- a/tarteaucitron.services.js +++ b/tarteaucitron.services.js @@ -371,6 +371,28 @@ tarteaucitron.services.googlemaps = { } }; +// google tag manager +tarteaucitron.services.googletagmanager = { + "key": "googletagmanager", + "type": "api", + "name": "Google Tag Manager", + "uri": "http://www.google.com/ads/preferences/", + "needConsent": true, + "cookies": ['_ga', '_gat', '__utma', '__utmb', '__utmc', '__utmt', '__utmz'], + "js": function () { + "use strict"; + if (tarteaucitron.user.googletagmanagerId === undefined) { + return; + } + window.dataLayer = window.dataLayer || []; + window.dataLayer.push({ + 'gtm.start': new Date().getTime(), + event: 'gtm.js' + }); + tarteaucitron.addScript('//www.googletagmanager.com/gtm.js?id=' + tarteaucitron.user.googletagmanagerId); + } +}; + // jsapi tarteaucitron.services.jsapi = { "key": "jsapi",