DEV Community

Cover image for Tag management just became a whole lot cooler
Frederik Sejr
Frederik Sejr

Posted on

Tag management just became a whole lot cooler

You may have come across tag management during the recent years, as a new way of adding marketing tags to a website.

It's main use-case is to easily and flexibly implement analytics tags or marketing snippets in a scalable way. Technically, it is just a JavaScript library with which you can generate other tags in the source code.

Though the advantages of tag management with GTM (Google Tag Manager) are based on enabling marketers to do analytics and advertising, this is not (anymore) the main thing to do with it:

Google has just released back-end tagging with GTM, which is currently in Beta.

You host a back-end tagging container on a Google Cloud instance and run it from App Engine. Then you assign a custom subdomain to it.

Advantages of back-end tagging

You can proxy all Google Analytics or add requests through your custom subdomain and thereby have all cookies in a first-party context. Why is that important? - Well, in the past Safari and other browsers took many steps against third-party cookies that would either block or purge them after a short period of time.

The result is that the same users are not recognized anymore and tracking data is artificially inflated. - Well not anymore!

Running a back-end container also allows you to host common scripts like analytics.js or gtag.js yourself and not rely on third-party servers.

Limitations

The code you can run on the backend is either a pre-defined template, or a custom template you create yourself. To create a template yourself, you will have to use GTMs serverside APIs, but there are plenty.

You can read out and modify request headers, bodies and the same with responses. You can also send get requests to other servers and so chaining APIs together may be a new interesting possibility. Previously it was possible from the frontend too, but that imposed security issues, which are solved when handling the data in the server.

What will or will not be possible is largely dependent on the provided APIs. But no matter what, tag management is definitely moving in an interesting direction, making it possible to run code serverside and hence making room for a lot a never before seen implementation flexibility.

Conclusion

Though serverside tagging is still in Beta, the available APIs already give us a good hint of what will be possible. We are still at an early stage, but I think it is save to say that tag management systems became a whole lot more attractive for backend developers now too, given this paradigm shift.

Top comments (0)