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",