Mapping of Ad Platforms Credentials with Multi-Domain Setup

I have been doing some research in the Multi-Domain Setup that Stape offers and I’ve realized that this feature is intended to use all the domains in the same sGTM Container. I thought at first that it was one container per domain.

What if we want to use specific Pixels & Access Tokens for each individual Domain. How would this mapping process? Is it via a Lookup Table in sGTM? (Lookup Table Variable for sGTM - Stape)

And one step further, what if we want to use specific Pixels & Access Tokens for each individual path / URL route for each individual Domain?

Also, I am reading here: Server-side GTM with multiple domains - Stape about the limitations of objects (tags, triggers, variables, clients) in sGTM.

If we plan to deal with 10 Ad Platforms, 3 Type of Events per Platform and 10 Domains. Is this really something that would bring some troubles?

All of the things you’re describing here need to be handled on the container side, so in GTM itself.

Yes, you can use lookup tables to supply destinations/api keys/ etc. dynamically into tags. You can also control which tags fire and don’t for fire any given domain (or maybe even more granular down to URL) with triggers.

The potential troubles with this all is container maintenance. It’s hard to forecast what sort of change one individual domain from your batch will require, so in a way you’re boxing yourself a little bit with the multi-tenant setup.

Ok, I see - So the main tool / element to do the correct mapping for a multi-domain structure in sGTM would be the lookup table, right?

How can I estimate if I would run into space problems in the sGTM?

I don’t want to set up everything, which will take some time, and then realize I can’t store it due to space limitations.

Lookup table would be the default one, yes. You can create your custom variables if you need more complex rules.

How can I estimate if I would run into space problems in the sGTM?

In over 3 years of practice, the only sGTM container that has size issues is the one running 200+ customers with over-the-top amount of automation and logic.

If we plan to deal with 10 Ad Platforms, 3 Type of Events per Platform and 10 Domains. Is this really something that would bring some troubles?

this description would be nowhere near the container size capacity limits


Is there any other guide apart from this one that explains in detail how to set up a multi domain infrastructure? Server-side GTM with multiple domains - Stape

@hustleou there isn’t a guide, we might make one eventually, but it’s rather simple really. instead of using constant for your ids/api-keys/destination urls you use lookup tables (based most likely on page hostname)

1 Like


I am also considering a single stape for multiple stores. We use the same platform (shopify) and really use the same stack of applications across all of them.

Generally I figured it might be good because:

  • If one site uses less computes to another, I end up having less extra in one and over in another
  • Better Support and reporting (compared to a bunch of pro’s)
  • being able to manage a single GTM set with updates etc.

I agree you are right, there is probably a need to run a lookup in order to generate a dynamic {{CON - Transport URL}} right?

I figure I would probably just create an array (although that lookup looks awesome) of the stores in JS and then push that variable to the server, then based on the value I would use the advanced lookup table to return the correct credentials based on that.

@Chris_Bradley the approach is correct, wether you gonna use a lookup per item, or deal with arrays - those are nuances, ultimately you’re getting the same result.

Awesome, that was my rolling concept. cheers.

@Dan but the Page hostname variable is only available in the web GTM, right? I don’t see that variable in the server GTM.

We would really need a guide on multi-domain infrastructure to be able to migrate our whole stack to Stape.

Please see this:

also any parameter you feel is missing, you can explicitly send from the web

I don’t quite understand how to use the “Event Data” variable in the server GTM. I have created this variable and used this key path:

But when I am testing it in the Preview mode, I see this:

How should I extract the “Page Hostname” from the “Event Data” variable?

Check Event Data tab, I believe this parameter is not being sent from the web. I assume you’re looking at a GA4 request - it doesn’t send page_hostname by default. You can add it explicitly in your GA4 tags, then your variable will resolve correctly.

Let’s say I don’t want to use the web GTM, and I want to only use the server GTM. Can this parameter be extracted from the headers of the webhook call to the server GTM URL? Or do I need to explicitly send this parameter (page hostname) in the body payload?

if such a parameter exists in headers - then yes. you have a native variable ‘request headers’ in your sGTM

What would be the name of that header parameter? I am currently testing from Postman and therefore there is no page hostname header associated with it.

@hustleou I don’t know - that depends on the requests you’re sending and where you’re sending it from, it doesn’t appear ‘magically’ it’s all a matter of how your request is configured

1 Like

@Dan do we really need multi-domain if we are just going to use sGTM with webhooks (for all the events)? I see multi-domain useful if the GTM JS tag needs to be placed in each different domain, each one with it’s own tracking sub-domain to use 1st party cookies.

But in this case, we are not using any kind of GTM JS Tag (nor web GTM).

By using the Lookup Table as a Variable and evaluating the Page Hostname I believe we can achieve the same functionality, without the need to go for the Multi-domain plan.

Is this correct?

Yes, if sGTM doesn’t set cookies, but just accepts webhooks and sends events based on them - you don’t need to use multidomain.

1 Like

I guess we are reaching max capacity. This is the base setup and only for the Purchase events. I need to also add Page View and Lead events. So at least 20 more Tags to add.

Do you think it will max out?

And why is there such a small capacity in the container? If all that’s stored is plain text.