Cross-domain setup for LinkedIn and Twitter

Hi Here,

I am in turmoil and need help with one of my client sites. The problem is mostly on the web tracking side and in the iFrame form tracking scenario.

The situation is that my client has some forms that are iFrame embedded and some forms that are submitted on the iFrame site itself.

If I elaborate on the scenario, then sometime upon clicking on the ‘Sign Up’ button, the form appears on the parent site as a pop-up, but that’s actually an embedded form.

In another situation, some forms, upon clicking ‘Sign Up’, redirect users to that child site itself, and the form submission happens there.

Till now, we had done tracking this way: We kept two separate containers—one on the parent site and one on the child site.

In the child container, we have one sender post message, and in the parent GTM container, we have one receiver post message, and that’s how we track embedded forms.

For those forms that redirect users to that child site (where the domain changes), we have tags in the child container—one Gtag that installs the same GA4 property but not on all pages but only that URL. The second one tracks the form submissions that happen directly in this child site domain.

Since both containers use the same GA4 property, we have a cross-domain setup there as well.
Everything works fine there.

Now the problem is:
My client wants to track LinkedIn and Twitter conversions. I am having doubts about using the same LinkedIn Insight ID and Twitter ID in both GTM containers.
The forms can be either embedded (which are being tracked in the parent container) or directly submitted on the child site.
I am not sure if this situation is normal or what I should do in the case of this type of cross-domain tracking. Seeking advice if anyone has been through the same situation. Is it normal to use the same LinkedIn Insight ID and Twitter ID across multiple GTM containers for multiple domains?

Thank you in advance.

There is nothing stopping you from using the same IDs in different containers, I don’t think it will be a problem.

But I don’t see the point in separate event tracking in iframe, especially in cross-domain format, I’m not sure how you could even configure it to work properly without a common ID that is available on both domains.

I think the most correct option here would be to configure sending events from iframe to parent window (Window: postMessage() method - Web APIs | MDN), on the basis of this add dataLayer event (when receiving a message from iframe - send it to dataLayer), so the events themselves will work in the parent window, where there are all the cookies and everything necessary.

Hi Alex,
Thanks for coming to the rescue.
Yes, we are using the postMessage() method only. But that applies to the usual Iframe tracking scenario.

My client’s website has some exceptional cases where, sometimes, upon clicking the button, the form doesn’t open on the parent site but takes to the iframe site (redirecting the user to a different domain), so these exceptional forms that are submitted on the child site.

I know it may be difficult, but the iframe domain is being used for all the forms throughout the site. sometimes in the form of embedding (where I can push the dataLayer event from the child container to the parent GTM), and sometimes the form happens on the child site domain where the postMessage request does not track it.

So per your statement, I am interpreting that I can use the same IDs across these two GTM containers. Please correct me if I am wrong.

Hi Nisha,
Ah, got it. Yeah, I don’t see any reason why you can’t use the same ID on different domains, quite a few businesses do that for example when regional sites are on different domains.

Great!
Appreciate your support.