Trying to understand GTM Docs - google-tag-manager

A client of us is asking us to move to server side tagging on GTM.
So I created a container, I verified the domain and all of that, then I followed this:
https://developers.google.com/tag-platform/tag-manager/server-side/send-data
Once the server container URL is set, data is sent to a client in your Tag Manager server-side container. By default, GA4 and a UA clients are pre-installed on your server-side container.
Key Term: "Clients" are adapters between the software running on a user's device and your server-side Tag Manager container. They receive measurement data from a device, transform that data into one or more events, process the data in the container, and package the results to be sent back to the device.
In your Tag Manager server container, click Clients in the left navigation to view the list of clients. Click the name of the client to view or edit details. In most cases, the client will require no modifications. However, there are settings that may require edits for certain cases:
So now, my site (drupal) is sending events to a GTM web container as it always was, and that web container is firing the events on the server container and tags to GA4, and then the server container fires the events to GA4 again.
Isn't that redundant and pointless?
I thought the idea was to cut the middleman and try not to cross domain boundaries to prevent cookies from being blocked.
Am I reading the docs wrong? maybe I'm assuming this is the way it should be setup and instead this is just an example to get data from an existing feed?

As #Darrellwan indicated, you don't need to use two containers in parallel.
What a lot of people are trying to do is to use the front-end GTM to send events about what happens to the page to the backend GTM.
Using front-end GTM in this case, however, is questionable since it's too easy to block with most of the adblockers. Therefore, people often just do tracking with arbitrary on-page JS, sending the details to the sGTM endpoint. But then the adblockers can block the sGTM endpoint, which is, too, not the best case scenario, so they deploy a proxying mirror endpoint on their backend that relays events to the sGTM endpoint.
As per cookies, there's very little cookie concern. GTM doesn't use third party cookies for tracking, so no issues on that front. And there are very few people who disable cookies in their browsers since that cuts off a lot of functionality.

If all you do is using GA4, then having a server-side GTM is a bit pointless; you still have to integrate a full GA4 installation on the client via GTM (because some GA4 events like session_start are only generated in the client-side GA4 code), so it does not even save you page weight by reducing JS code.
The situation changes somewhat when you have additonal marketing tags, since you do not have to send a request to server-side GTM for every tag, but instead can re-use the data from the GA request for other tags. With a bit of programming you can also convert javascript cookies to server-side cookies, which makes them a tad more robust against some ad blocking features, and you can redact e.g. personal data before you fire tags to a marketing vendor.
The limits are tags that interact with the website, or tags that rely on 3rd party cookies (both not possible from a server-side container), so feedback tools, remarketing tags and similar cannot be used from a server-side container.
But yes, if all you want to do is to run GA4, then you do not need GTM at all (neither server-side nor client side) and would be better off with gtag.js (a sort of trimmed-down tag deployment solution for Google tags only).

Related

Server Side Event for Floodlight tags

We are using Google Tag Manager (GTM) to host all the tags including Floodlight tags. One of our conversion events can happen offline and hence, we are thinking to use Measurement Protocol to send the conversion events for GA4. It is working great so far. However, we also need to send that event to Floodlight tags and we are not sure how it is possible to do it.
We are exploring Server Side Tagging in GTM and saw an official guide here. However, it seems that the trigger needs to be online (or some sort of browser). I don't think Measurement Protocol call from backend server can trigger this event to record the conversion in the Floodlight tags.
Has anyone faced this issue before and what would be the ideal solution? Thanks!

Tracking iframe origin

I am creating a Web Widget, a page that customers can use within an HTML Iframe in order to embed our experience on 3rd parties and vendors.
The site will be public, I am not willing to ask consumers to register in order to have a key or a unique identity to be passed as a query param for example (e.g. ?id=<unique_id>).
On the other hand, I need to track who is using the iframe. What are my options? A colleague suggested using the request headers, such as the origin, to track the usage on the server-side. Is that a good strategy? I'm not sure how much I can trust the origin header.
What if I fire an event (hence a client to server call), at page load (such as analytics) which logs the current page URL? Would that work, from within an iframe?
I am pretty sure I am reinventing the wheel here. What would be some good recommendations?
Thanks!
For others ideating for a similar solution, my fix was actually to simply hook a proper client analytics to the page, and trigger a page load event, upon page load, which would push not just the page, but quite a few other properties to our analytics.
Also, we added a clientId query param to our urls, so that we could identify precisely who was serving the iframe visited by the user.

What is equivalent of Facebook pixel in GTM for server side tagging?

With recently introduced feature of GTM, server side tagging and it's known benefits, I want to move my Facebook pixel browser code on server. So I am looking for equivalent of Facebook pixel for server side tagging.
The closest thing I found is Facebook Conversion api but not exactly same.
Would like to hear other views on how they are achieving this
There are quite a lot to learn and work to do this.
You need to understand the Facebook pixel hit's payload. Something like https://www.facebook.com/tr/?id={{pixelId}}&ev={{event}}&dl={{Document location}}...
Assemble the payload and send it to your Server Side GTM.
Create Client in the Server Side GTM to receive the hit.
Create Tag to dispatch the hit to Facebook.
The Server-Side GTM is not supported the 3rd party cookie and it means that the Facebook will not recognize the user you send from Server-Side GTM.
Facebook report will only show the conversion or event amount.
Can't use this for remarketing or attribution.
There are was no official Tag from Facebook for GTM Server Side. That's why I created my own https://github.com/gtm-server/facebook-tag
The tag sends the event data from the Universal Analytics/GA4 client to Facebook.
It developed exactly like an easy replacement for Facebook WEB pixel.

Can I get server side events sent into Google Tag Manger

We need to track some server-side events given that some of the activity done by our users is offline over the phone and send these events over to multiple tracking tools and ad networks to stop or intensify remarketing budget.
We have been reading about Google Analytics Measurement Protocol But this only fixes the issue for GA and other Google products (Google Ads), but it won't fix the issue for other networks (Facebook Ads, AdRoll, Outbrain, etc)
What I think would solve the issue is having these events pushed into Google Tag Manager, and collected by triggers and variables that would shoot out the right tags. This setup would allow our marketing team to stay in control of notifying the desired ad network to take action.
While it might be technically feasible I think making GTM work on server side would be a huge hack. Google Tag Manager is used to manage JavaScript and HTML tags and does not provide any server side API (apart from REST Api used to mange your accounts and containers).
The reason why I think it is technically feasible is this: GTM injects scripts to your website and relies on window component and events that do not exist on the server side. Therefore you would have to spin up some client on your server (like Electron) to make it work and then feed events to the client. You can try doing this for fun but I would not advise doing this for any commercial server.

How can I get website analytics data of bots and users with no javascript and/or cookies?

Is it possible to get the info about website traffic without Google Analytics, for example?
For tracking without Javascript you can use the Measurement Protocol, i.e. you send a request to the Google Analytics Server with query parameter that specify the type of interaction (pageview, event etc) and the data you want to track.
General info is found in the protocol reference, a list of valid parameters is here, and if you want to test your tracking requests you can use the hit builder, which allows you to assemble, validate and send a hit to Google Analytics.
As for tracking without cookies that probably won't work very well. You need a persistent id to assemble hits into sessions, and sessions into visits. Such an ID is usually stored in a cookie (your "no javascript" requirement means that things like local storage are out of the question). You can either decorate all your links with a client id and use that to persist the parameter from page to page, or you use some sort of server-side browser fingerprinting.
All in all this might be somewhat less trivial than you assume, especially if you do not only want to track pageviews but also events that do not load a new page.

Resources