Extension talk:GTag

About this board

Leaderboard (talkcontribs)

Title. We can't see any JS tracking code when opening developer tools, but we do see hits when looking at Google Analytics.

Skizzerz (talkcontribs)

$wgGTagHonorDNT defaults to true, and a lot of browsers either default to or can be easily configured to sending the DNT: 1 header. If that config is true and the DNT header is present, no tracking js is generated. Additionally, if you're in a group with the gtag-exempt right, no tracking js is generated.

Reply to "How does this work?"

Direct link to GTag 1.2

3
Leaderboard (talkcontribs)
Skizzerz (talkcontribs)

I wouldn't recommend trusting random download links such as this one, please use one of the official download mechanisms (mwusers or GitHub).

Leaderboard (talkcontribs)

That option (i.e, GitHub) was explicitly mentioned only a few days back.

Reply to "Direct link to GTag 1.2"
2001:9E8:97B:B900:E11D:E8B9:3BD0:D454 (talkcontribs)

Will this extension be updated at some point? The current version is already 2 years old. Google is now transitioning all to GA4, wondering if that's compatible

Skizzerz (talkcontribs)

GA4 is already supported with the current (2 years old) version of the extension. Simply supply your "G-" ID to the extension configuration.

Reply to "New GA4 tag?"
Simonk (talkcontribs)

Hello! I think this extension should show a message to accept or decline the cookies because GA doesn't respect the GDPR in European countries without the agreement of the user.

Skizzerz (talkcontribs)
Reply to "GDPR"

Add Google Tag Manager options as well?

2
Blinkingline (talkcontribs)

Would it bepossible to add Google Tag Manager configuration with this as well? As Google moves to "tag-based" analytics, I could see there being some value with adding these via an extension.

The Tag Manager requires two snippets where GTM-XXXXXX is a unique identifier. The first one, "as high in within the <head> as possible:"

<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':

new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],

j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=

'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);

})(window,document,'script','dataLayer','GTM-XXXXXXX');</script>


And this one just after the opening <body> tag:

<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXXX"

height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>

CarolinaReidBangingRocksDev (talkcontribs)

@Blinkingline Were you able to find a solution to this (add a Google Tag Manager) in your MediaWiki site? I am facing the same problem.

Reply to "Add Google Tag Manager options as well?"
14.177.219.109 (talkcontribs)

Do I have to have the exact UA-xxxxxxxx-x format when filling in the ID in LocalSettings? or is just the xxxxxxxxx part is fine?

Skizzerz (talkcontribs)

The entire thing, including the UA- prefix (if that's the type of tracking id you have; Google has a handful of different prefixes).

Reply to "ID Format"

Difference from Google Analytics Integration

2
Knomanii (talkcontribs)

Sorry if this is a dumb question. I'm trying to figure out the best way to add Google Analytics to my wiki.

What's the difference between GTag and Google Analytics Integration extensions?

I downloaded the other one because it seemed to be maintained by Wikimedia Foundation, but now I'm not sure if I downloaded the right extension.

Thanks!

Skizzerz (talkcontribs)

Neither extension is maintained by the Wikimedia Foundation. This one uses the newer global site tag (gtag.js) API, the other extension uses an older (legacy) google analytics API. They may have a handful of functionality differences as well in terms of configuration and features.

Reply to "Difference from Google Analytics Integration"
Ulrich C. Thiess (talkcontribs)

How could i anonymize IP-addresses?

Skizzerz (talkcontribs)

This is not currently supported but I’ll look into adding it.

Ulrich C. Thiess (talkcontribs)

Since DSGVO it is a MUST in germany.

Skizzerz (talkcontribs)

Version 1.1.0 has been released which adds a new configuration option for this.

Ulrich C. Thiess (talkcontribs)

Many thanks works perfectly.

One more: We also uses the Google-TAG-Manager wich came with its own code for the <header> and with code for <body>

It looks like:

<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:;j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-PTCRZHX');</script>

and

<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-PTCRZHX"
 height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
Reply to "Anonymize IP"

Google Analytics show no traffic

1
Costas Athan (talkcontribs)

Is there a delay till Google Analytics start delivering data for the first time for a website? I have set up Google Analytics more than 24h ago, I see the tag in the wiki's source code, but Realtime monitoring shows 0 traffic.

Any ideas?

Reply to "Google Analytics show no traffic"
There are no older topics