We want to set up only server Google Tag Manager (no web GTM). We are passing all events via webhooks. One of the fields of our webhook JSON body would be “ad_click_id” which will include the name and the value of the parameter corresponding with the advertising network / traffic source (with this format > click-identifier-name_click-identifier-value). For example, for Facebook:
ad_click_id: fbclid_jkjk123jk123j1k23
and for TikTok:
ad_click_id: ttclid_jk23jkajsdkajsdksad
How should we map these values with their corresponding tags in sGTM? Should we use Transformations in some way? How should we implement a logic so that the “fbclid” value matches Facebook tag in sGTM? And how to strip / separate the param name from the param value (underscore)?
What is the recommended way to implement this overall? Should we send the event we are receiving from Facebook (with fbclid in the URL query) to all the other configured tags? or should we just send the event from Facebook just to Facebook?
As to removing redundant pieces of the value, you can use some varilabe from the gallery (or make your own custom one). This for instance should work fine for you, cause you can just split by ‘_’ Tag Manager Template Gallery
Ok, I see what you mean. I understand the “Split extract” function of that Variable template as well. It will split the string and extract the value after the underscore, which is the Click ID.
What’s not clear is if I should create 1 Variable for each Click ID type (e.g. one variable for “fbclid”, one variable for “ttclid”, one variable for “gclid”), or if I can use 1 Dynamic Variable for all Click IDs. Like using an OR operator or something.
1 dynamic would not work well probably, cause you have at least 2 different tag templates to use it in. So it seems easier to have one instance for each type of click id you’re expecting
Is there a problem if TikTok receives a Click ID value that comes from Facebook? Will TikTok automatically rejects / discard this event in this case?
yes, all those platforms have specific click_id formats, even if they don’t get rejected on tag level it’s hardly a good idea to feed the destination with false click ids.
Ok, it makes sense what you say. But then, how can I implement this logic in sGTM (individual click id parameter per traffic source / tag)?
It is clear that the “Number & String Operations” variable can get this type of string: fbclid_jkjk123jk123j1k23 and return just this value: jkjk123jk123j1k23
But I think I would need some more logic like: if the first parameter is “fbclid”, then return jkjk123jk123j1k23, and that variable would be just for Facebook. and if the first parameter is not “fbclid”, return empty. For TikTok, the same: if the first parameter is “ttclid”, then return jkjk123jk123j1k23, and that variable would be just for TikTok. and if the first parameter is not “ttclid”, return empty.
Not sure how to set this up in sGTM with a variable.
For example, let’s say we have a campaign running on Facebook. Does it makes sense to send the “Purchase” conversions happening from Facebook traffic to other traffic sources (TikTok, Google and so on) as well? (without adding the FBCLID value to the other traffic sources, leaving that click ID value empty)
From the top of my head, make a lookup table with input of split[0] of your click id, make it return tiktok/fb/whatever based on what’s contained in the prefirx part of the value - now you have a variable that tells you which click_id you just received.
Now have a set of lookup tables for each platform checking if the variable described above matches your destination, and return split[1] on successful match or undefined (native variable) otherwise.
Or you can just whip up a custom template with a bunch of IF clauses. There’s a lot of ways to achieve this, get creative The simplest one though is to amend the initial webhook data so that you don’t need all these shenanigans in the container.
For example, let’s say we have a campaign running on Facebook. Does it makes sense to send the “Purchase” conversions happening from Facebook traffic to other traffic sources (TikTok, Google and so on) as well? (without adding the FBCLID value to the other traffic sources, leaving that click ID value empty)
yes, it does make sense because ultimately that data will be used in optimisation algorithms etc. even if it didn’t originate from the platform in question
Let’s say that I’ve already set up the Lookup table that you’ve described in Step 1.
if fbclid > Facebook
if ttclid > TikTok
How can I check the “destination” that you described?
Other way would be to add each of the click identifiers to the webhook payload as a different key in the object, but I prefer the more optimal way which is having all in one value (ad_click_id) and then processing it with sGTM.