Adsmurai-Google-Tag-Manager-Templates / adsmurai-facebook-pixel-and-conversions-api

Google Tag Manager template that fires Facebook, TikTok & Pinterest events through regular pixel and Conversions API.
Apache License 2.0
19 stars 8 forks source link

Tag is firing but status is "Failed" #1

Open vasfvitor opened 3 years ago

vasfvitor commented 3 years ago

Hi @Slaventuss and all!

I'm sorry for my late reply, I didn't receive any notification that you opened this issue and I just stumbled into it by sheer luck.

@vasfvitor nailed it, though I have some things to add. Let's see the process step by step:

  1. You use this template on the GTM web container to send the events to the pixel ID and also to your server's URL. The template will handle deduplication and all.
  2. But then, yes, you need a server who will be responsible to receive the CAPI events and send them to Facebook (that's what you are missing on the Tag management server's URL field). Luckily, there's a server version of GTM. Here you have instructions on how to create and set up that GTM server. That GTM server will be responsible of receiving incoming calls with event data from the GTM web and send that data to Facebook CAPI.
  3. On the GTM server, you have two main entities to make the integration work: clients and tags. Simo Ahava's tutorial relies on the GA4 client that's already on the GTM server to send the events to Facebook through CAPI. The other way I propose you is to use the client and the tag I developed for GTM server specifically for handling Facebook CAPI events. The problem is that, currently, these two templates are not in the GTM gallery, not sure why. So, you'll have to download the "template.tpl" file in each repository and import it into GTM server in order to be able to use them.

I hope this clears the path a little bit. Anything else, let me know :)

Originally posted by @angelbt91 in https://github.com/Adsmurai-Google-Tag-Manager-Templates/adsmurai-facebook-conversions-api-tag/issues/1#issuecomment-863964295

vasfvitor commented 3 years ago

image Web: Tag Status Hi, I'm trying to setup as suggested but I'm getting this situation:

This tag on the 1st image is on the WEB and is set to fire when DOM Ready, but it shows "Firing status: Failed". I have tried disabling all other tags and testing another triggers. The browser console shows "Cross-Origin Read Blocking (CORB)" to my gtm.mydomain.com/fb

In the SERVER, I downloaded and installed the Adsmurai Client and Tag and it shows succeeded.

The data from the WEB seems to be reaching the server, the Adsmurai Client status shows "claimed" (I'm using /fb in the cliente too)

I'm not sure if this (Status: Failed) is a problem or not.

image Server: Tag Status

image Server: Cliente Status

Thanks.

angelbt91 commented 3 years ago

Hi @vasfvitor! :)

Yes, this is a known issue. Everything is correctly set up and even Facebook's Events Manager shows that it's receiving the events, but still, the GTM debugger shows that the web tag "Failed" when firing.

The problem is in this line of code. Here is where I send the event to the server, and if the call to the server succeeds, it will call to gtmOnSuccess(). If it fails, it will call gtmOnFailure(). The first call will make the debugger show "Succeeded", and the other one "Failed". But, somehow, gtmOnFailure() gets always called, even though the events are working correctly. I'm not sure if it's a bug on GTM's end or on my code. I've already investigated it but without luck.

If you have any suggestion or idea on how to keep investigating this issue, just let me know and I'll have a look :) Either way, you can just ignore this "Failed" label. If Facebook's Events Manager says it's receiving data, or if the debugger in the GTM server says Facebook is replying with a code 200, you are safe.

Thanks!

vasfvitor commented 3 years ago

Oh my, thanks, then it's working fine, the debugger is showing code 200 and FB Event Manager is ok. I have no suggestion or idea yet.