TheEdge
TheEdge

Reputation: 9881

Google Tag Manager (GTM) Data Layer via REST API

We need to push events to GTM. Typically this is done via JavaScript using the datalayer as described here using:

<a href="#" name="button1" onclick="dataLayer.push({'event': 'button1-click'});" >Button 1</a>

What I want to know is:

  1. Whether the above is possible using the REST API for this as also asked in the SO post?
  2. Is there any client side session info (eg IP address, browser etc.) captured using the JS approach as part of the GTM call?

Upvotes: 2

Views: 4016

Answers (1)

Eike Pierstorff
Eike Pierstorff

Reputation: 32780

Update: Google by now supports server-side tag management. While SSGTM is not a Rest Api in any formal sense, you can send data there via an http endpoint.

--

  1. If by the REST API you mean the Google Tag Manager API then no, this is for GTM configuration only.

GTM for web pages is not run on the server in any case - it bundles the configured tags into a Javascript function that is evaluated and executed in the client, so there is nothing you could push the data to. And while it is vaguely possible you could reverse engineer the network calls from the Mobile SDK (mobile GTM is pretty much a different product with the same name) there is no supported API outside the platform specific SDKs.

  1. GTM (for web) can evaluate everything that can be retrieved via Javascript. So browser yes (via the navigator object), but no IP addresses, no http headers etc.

Upvotes: 4

Related Questions