Add gtag.js

This commit is contained in:
Amauri CHAMPEAUX 2018-02-07 03:14:32 +01:00 committed by GitHub
parent 48d582f752
commit a34ae7d1d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 24 additions and 0 deletions

View File

@ -816,6 +816,30 @@ tarteaucitron.services.analytics = {
}
};
// google analytics
tarteaucitron.services.gtag = {
"key": "gtag",
"type": "analytic",
"name": "Google Analytics (gtag.js)",
"uri": "https://support.google.com/analytics/answer/6004245",
"needConsent": true,
"cookies": ['_ga', '_gat', '_gid', '__utma', '__utmb', '__utmc', '__utmt', '__utmz', '_gat_gtag_' + tarteaucitron.user.gtagUa.replace(/-/g, '_')],
"js": function () {
"use strict";
window.dataLayer = window.dataLayer || [];
tarteaucitron.addScript('//www.googletagmanager.com/gtag/js?id=' + tarteaucitron.user.gtagUa, '', function () {
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', tarteaucitron.user.gtagUa);
if (typeof tarteaucitron.user.gtagMore === 'function') {
tarteaucitron.user.gtagMore();
}
});
}
};
// google maps
tarteaucitron.services.googlemaps = {
"key": "googlemaps",