Gtag variable should be set in global scope for later use (gtagMore or event calls)

This commit is contained in:
Julien Petit 2018-07-11 17:28:45 +02:00
parent d585d87c34
commit bbd6cc01b9
1 changed files with 1 additions and 1 deletions

View File

@ -1073,7 +1073,7 @@ tarteaucitron.services.gtag = {
"use strict";
window.dataLayer = window.dataLayer || [];
tarteaucitron.addScript('https://www.googletagmanager.com/gtag/js?id=' + tarteaucitron.user.gtagUa, '', function () {
function gtag(){dataLayer.push(arguments);}
window.gtag = function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', tarteaucitron.user.gtagUa);