Custom Server-Side Google Tag Manager Client Templates
MarkusBaersch1
51 views
33 slides
Oct 13, 2024
Slide 1 of 33
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
About This Presentation
Slides from GTM4ward session 2024-10-15.
Size: 7.85 MB
Language: en
Added: Oct 13, 2024
Slides: 33 pages
Slide Content
Custom GTM Client Templates (and why it is so hard to replace gtag / GA4) Markus Baersch
What is a client in ssGTM?
ssGTM “Receiving Thingies” in ssGTM Events key1: value1 key2: value2 key3: value3 … Tags Tag Tag Tag Clients Client Client Client /endpoint?param1=x¶m2=y…
Common client tasks Respond 3 process (response) data from tags send server response (usually) “Decouple” tags from raw requests 2 create event data run container to trigger tags Receive requests 1 different endpoints or same endpoint and different priority (first to “claim” wins)
How “clients” got their name And finally: how should we call those receiving thingies? worker! listener! e ndpoint! collector! sensor! receiver! event processor! client 💩 Senior dev had dark mode and could speak in Courier New. So unfortunately, he took the jackpot… :(
Clients in ssGTM
Clients in ssGTM
Event Data: What tags need to work
Comparing GA4 requests
Q: Will a GA4 request be the same after passing ssGTM? https://www.diffchecker.com/R1z4xmC9/ A: No
Q: What if GA4 adds new parameters?
Everything ends up in X- Files Fields ;)
Building client templates
Building a custom client is easy! https://developers.google.com/tag-platform/tag-manager/server-side/api
Custom client use cases Analytics / Data Snowplow Piwik PRO … Proxy Tagless Request Proxy APIs “Cloud Functions” Preflight Requests Alternative (GA4) clients Serve resources Static or dynamic
GA4 requests / client alternatives?
Building a custom GA4 client is (still) easy!
Replacing GA4 requests is not easy GA4 Measurement Protocol Needs help by a web session and drops weights on own foot Universal Analytics Measurement Protocol Goes all the way
Replacing GA4 requests is not easy browser controls everything! e.g. start, count, end of session parameters constantly change ! Consent Mode -> running GA4 on a non-GA4 request stream is hard!
GA4 event data…
… is quite different
Options live with some constraints do not expect data suitable for advertising mimic gtag in the browser and use GA4 client use alternatives like walker OS, Stape data tag do not use GA4 at all ;) -> use custom clients for other tools or tasks!
Example: walker.js in, Piwik PRO out
Example: walker.js in, Piwik PRO out
Server-Side Custom client tips Good to know: always return a response (there is more than a status code) running the container is optional clients can use the same APIs as tags requests can contain multiple events
Server-Side Custom client tips When more clients are used : check your trigger conditions “all events” or “all pages” triggers are no longer your friend use transformations whenever clients and / or tags do not allow event redaction