google-tag-managergoogle-tag-manager-server-side

Sending custom data to Google Tag Manager Server Side container


I have just configured a server side instance of Google Tag Manager for a site and have successfully routed all Analytics data through from the client container.

My question is regarding the best method for sending data to be consumed by a custom client? For example let's say I have a client on server side that watches for requests made to /collect/lead and expects this to have properties foo and bar which are defined from 1st Party Cookies on client side.

My current implementation is using Custom HTML tags on the client side to send a request to endpoint with Iframes.

<iframe src="https://gtm.mydomain.com/collect/lead?foo={{Cookie_Foo}}&bar={{Cookie_Bar}}" height="1" width="1" frameborder="0"></iframe>

What would be a better way of sending requests from GTM Client side?


Solution

  • I created custom Data Client (source on GitHub) for GTM Server Side and Data tag (source on GitHub) for GTM Web container. You can use a Data tag to send info from the Web to the Server.

    Also, you can check out my detailed How to send data from Google Tag Manager Web Container to Server Container