Merge pull request #452 from prudloff-insite/multiplegoogletagmanager

Add support for multiple Google Tag containers
This commit is contained in:
Amauri CHAMPEAUX 2020-07-02 08:36:30 +02:00 committed by GitHub
commit eed7a5cf0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 26 additions and 1 deletions

View File

@ -1372,6 +1372,32 @@ tarteaucitron.services.googletagmanager = {
}
};
// google tag manager multiple
tarteaucitron.services.multiplegoogletagmanager = {
"key": "multiplegoogletagmanager",
"type": "api",
"name": "Google Tag Manager",
"uri": "https://adssettings.google.com/",
"needConsent": true,
"cookies": ['_ga', '_gat', '__utma', '__utmb', '__utmc', '__utmt', '__utmz', '__gads', '_drt_', 'FLC', 'exchange_uid', 'id', 'fc', 'rrs', 'rds', 'rv', 'uid', 'UIDR', 'UID', 'clid', 'ipinfo', 'acs'],
"js": function () {
"use strict";
if (tarteaucitron.user.multiplegoogletagmanagerId === undefined) {
return;
}
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
'gtm.start': new Date().getTime(),
event: 'gtm.js'
});
tarteaucitron.user.multiplegoogletagmanagerId.forEach(function (id) {
tarteaucitron.addScript('https://www.googletagmanager.com/gtm.js?id=' + id);
});
}
};
// google webfonts
tarteaucitron.services.googlefonts = {
"key": "googlefonts",
@ -3132,4 +3158,3 @@ tarteaucitron.services.adobeanalytics = {
tarteaucitron.addScript('//assets.adobedtm.com/launch-' + tarteaucitron.user.adobeanalyticskey + '.min.js');
}
};