How and when is the stape data tag on web loaded?

Hey,

First, I want to thank you for investing so much time and energy into google-tag-manager server-side related topics and building a community around it. Your third-party tags made our entry into the sGTM world quite smooth.

Coming to the topic of the post: To make our tracking more resilient, we are currently considering switching from the GA4 client setup to the stape data tag/client.

We have a test setup up and running, and it works perfectly fine for our view_cart event. What we are trying to understand is how the client/server communication is possible. We do not see any stape related script being loaded on the client side. Is the tag code part of the gtm.js file?

We noticed the data-tag script file contains a reference to the stape cdn, but also that file is not being loaded.

Could you elaborate a bit how the custom JavaScript for the data-tag is being loaded?

Hi there,

  1. Script is loaded from https://cdn.stape.io/dtag/v5.js as you can see in template permissions.

  2. Script is loaded only if DT needs to send a ‘POST’ request, i.e. for GET requests script won’t be loaded. For GET requests it will use native GTM sendPixel method Custom template APIs  |  Google Tag Manager Templates  |  Google Developers

  3. With latest template update (just few hours ago) you can select where to load it from (in case you want to avoid Stape CDN)

  4. Be mindful when switching GA4 (in full) to Data Tag / Data Client, although you can successfully send events with proper payloads, there is no guarantee that GA4 would receive everything it needs beyond basic event + value

Point 2. Is what we tried to understand, thanks! In our test case, a GET request was issued, that is why we don’t see any additional JavaScript being loaded. Is my assumption correct that for GET requests, the tag code is then part of the JavaScript generated by the Google Tag Manager client?

Re 4.

there is no guarantee that GA4 would receive everything it needs beyond basic event + value

I assume you are referring to Google Analytics itself? We are not using the GA4 for analytics. We have been just using the GA4 client for the web to server communication.

p2. Yes, it uses native GTM js, I’ve linked you to the API description.

p4. Oh, if you’re just choosing a Client for web-server comms then I definitely encourage you to use Data Tag / Data Client. In setups we manage, GA4 Client is used exclusively for GA4 itself and Google Ads, everything else runs off of DC.

Does the stape client automatically switch between GET and POST depending on the payload?

In setups we manage, GA4 Client is used exclusively for GA4 itself and Google Ads, everything else runs off of DC.

Ah darn, the GA4 client is needed for Google Ads?

Does the stape client automatically switch between GET and POST depending on the payload?

Data Tag* not client, but yes, it decides depending on payload and settings

Ah darn, the GA4 client is needed for Google Ads?

Yes, I have not seen successful server-side Ads implementations w/o GA4 Client, exception would be Offline Conversions, but that might not be enough in your case

Hey Dan, how do we load it from our own domain?

@Adeola_Morren

there is a source URL field in DT:

you can use it in conjunction with Check our File proxy power-up - Stape

Hey @Dan the powerup seems to only be available on the really high volume plans. I did see the Proxy File client by stape. Can we use that also?

sure, same idea behind it