• Priority: Medium
  • Status: Waiting on customer
  • Theme: Alysum
  • Assigned To: Fred
  • Private: No
  • Open Date: 03.11.20, 14:04
  • Opened by: cavozzi

Ticket #19680 - Google ananlytics new version

i’m trying to add new google analytics G4
my global code is G-BGFH9YPY3P

and script is:

<!– Global site tag (gtag.js) - Google Analytics –>
<script async src=”https://www.googletagmanager.com/gtag/js?id=G-BGFH9YPY3P“></script>

window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-BGFH9YPY3P');


how to add code and tracking to desktop and mobile ?

thank you


Fred 03 Nov 2020, 14:05

Hi, cavozzi.
Please use Google Analytics module what you can find in your back office where you have to add an ID only

cavozzi 03 Nov 2020, 14:12

ok but if i put G-BGFH9YPY3P don't work (i try on analytics and system don't show user online)
Google analytics has changed and the UA code no longer exists

Fred 03 Nov 2020, 14:15

Ok, I just added your code into the file

cavozzi 03 Nov 2020, 14:30

thank you, the code work also on mobile version?

Fred 03 Nov 2020, 14:31

no for mobile, add that your ID to the AMP module settings

cavozzi 03 Nov 2020, 14:35

mmmm desktop work, mobile no ( i don't see user from mobile on live analytics)

cavozzi 03 Nov 2020, 15:41

i try again, nothing

cavozzi 03 Nov 2020, 16:54

are you looking for?? thank you

cavozzi 04 Nov 2020, 12:45

AMP version on analytic is invisible.

<!– Global site tag (gtag.js) - Google Analytics –>
<script async src="https://www.googletagmanager.com/gtag/js?id=G-BGFH9YPY3P"></script>

window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-BGFH9YPY3P');


Fred 04 Nov 2020, 13:29

if you are using Google Tag manager you have to add your ID here https://take.ms/0rfSx

cavozzi 04 Nov 2020, 13:37

yes i create the tag, do you can check if it work?

<!– Google Tag Manager –>
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
<!– End Google Tag Manager –>

<!– Google Tag Manager (noscript) –>
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-KTVGBN6"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!– End Google Tag Manager (noscript) –>

Fred 04 Nov 2020, 13:39

as I can see the code is present in the AMP pages https://take.ms/fgp2E7

cavozzi 04 Nov 2020, 13:41

Ok perfect. There is a system to check in realtime if analytics take the data?
thank you

cavozzi 04 Nov 2020, 17:01

I checked on google analytics but mobile visits are not recorded :(

cavozzi 05 Nov 2020, 15:34

Are you looking for? thank you

Fred 05 Nov 2020, 16:18

We have checked out everything once more and everything is correct in the code.
We have followed this google tutorial how to add Google Tag manager https://support.google.com/tagmanager/answer/9205783?hl=en

Please read it carefully and configure your google account as described there

cavozzi 05 Nov 2020, 16:43

i have already use the google tag manager tutorial.
But analytics don't take mobile...

Fred 05 Nov 2020, 16:44

did you configured it for AMP as described in the tutorial?

cavozzi 05 Nov 2020, 16:45

yes, but it don't work

Fred 05 Nov 2020, 16:48

The thing what we as developers have to do are pretty easy
1. Add an analytics script - Done
2. Call google tag manager config - Done

All other configuration steps are on your side

Fred 05 Nov 2020, 16:49

You can disable AMP if you want

cavozzi 06 Nov 2020, 15:28

i have created the tag, but don't work, this is the code of my tag:

<!– Google Tag Manager –>
<amp-analytics config="https://www.googletagmanager.com/amp.json?id=GTM-NRVD3H2&gtm.url=SOURCE_URL" data-credentials="include"></amp-analytics>

Fred 06 Nov 2020, 16:03

if you take a look into the source code you will see the tag is present on your page https://take.ms/a6lCK

cavozzi 06 Nov 2020, 16:04

ok is present, but analytics don't see mobile visit... :(

Fred 06 Nov 2020, 16:05

but what I have to do? We already added a code as google asked us

cavozzi 06 Nov 2020, 16:06

ok i tre-try to see if analytics see mobile visit

Fred 06 Nov 2020, 16:08

these are two easy steps what google ask us to do https://support.google.com/tagmanager/answer/9205783?hl=en and we did both of them
1. analytics script is added
2. google tag manager called