1
votes

I'm trying to set up Facebook Conversions API with GTM Server Side using the GA4 setup.

My website is a Single Page App, so I have to re-create page view events manually.

Facebook requires both browser and server events to contain an event_name and event_id property to deduplicate events properly. So this information needs to be passed through the payload to the server-side.

I've tried different things on the Client Side GTM container:

  • Set up both the GA4 Configuration Tag and FB Web Pixel Setup Tag to record a page view event. Apart from the transport_url param, the GA4 Configuration tag has extra parameters, including event_name 'PageView' and event_id. The FB Web Pixel Setup Tag is firing a fbq track event 'PageView'
  • Set up both the GA4 Event Tag and the FB Web Event Tag to record a page view. I still need to fire up the GA4 Configuration tag and FB Web Pixel Setup Tag on every new page regardless (this time I've removed the event_name and event_id properties from both setup tags and unchecked the "Send a page view event when this configuration loads" from the GA4 Configuration Tag.).
  • Set up the GA4 Event Tag and the FB Web Pixel Setup Tag to record the event 'PageView' and Event Id. I still need to fire up the GA4 Configuration tag - I've removed the event_name and event_id properties from the GA4 setup tag and unchecked the "Send a page view event when this configuration loads" option).

Here are the results I'm getting:

  • In the first scenario, I am getting on FB test tool a browser event called 'PageView' with an event_id set; I am getting, however, a 'user_engagement' event coming from the server-side, instead of the desired 'PageView' event. The event id matches, but deduplication only happens if both event_id and event_name are the same. Checking GTM payload, I can see that the event name received is 'user_engagement' and not 'PageView' despite this being what is set in the event_name property in the GA4 Configuration Tag. Regardless of the key-value in event_name, it always comes up as 'user_engagement'. I've also tried having the tag fire automatically a Page View on load (through the checkbox available for that in the tag), and in fact, I can fire a 'PageView' event, although no event_id is passed this time, so no luck getting it deduplicated...

  • On the second scenario, on page load, I get both browser and server-side events with the correct event_name and event_id. However, when navigating to a different website page, while the server-side event is fine, the browser event comes up without an event_id...

  • On the last scenario same behavior as the previous one.

I'm running a bit out of options here. Any suggestions?

Not sure why this question was closed. I did my research and found similar questions, but that did not touch the SPA condition, hence I decided to create this one. I can see the reasoning to be: "We don’t allow questions about general computing hardware and software on Stack Overflow. You can edit the question so it’s on-topic for Stack Overflow or post a new one on Super User." , however since I can see plenty of questions about both GTM and Facebook, I'm not sure these are the 'software' references that this relates to?Pedro Marzagão