Setup Facebook Conversions API with Google Tag Manager (server-side)
Вставка
- Опубліковано 27 лип 2024
- How to set up server-side tracking for Facebook Conversion events with Google Tag Manager server containers. www.accuracast.com/services/s...
This detailed guide provides a step-by-step walkthrough for businesses that already use GTM and wish to setup Facebook CAPI without having to hard-code it onto their website.
Conversions API allows you to share key web events with Facebook, helping you create more relevant ads and build more meaningful connections with your customers.
Server-side GTM enables you to move your data collection mechanisms from your website into a server container in your Google Cloud account.
Comment if you have any questions and we will answer them in a follow-up video or in the comments section below.
If you need help setting up data layers and refining your Google Tag Manager + Facebook Conversions API implementation, contact us on www.accuracast.com/contact/.
CONTENTS
00:00 - Requirements
00:44 - Create GTM server container
01:51 - Add Facebook CAPI tag
02:35 - Get Facebook Access Token
05:43 - Prepare GTM web container
06:30 - GA4 config tag
08:38 - Event ID
11:00 - Set Facebook events
12:40 - Data layer information - Навчання та стиль
Here's how you can set up Event IDs for Facebook Pixel & Facebook CAPI event deduplication via GTM: ua-cam.com/video/Oi0uDxwdG6M/v-deo.html
Thank you, that really helped
I want to thank you very much for this amazing tutorial, and I trust this informations you just giving here worth so much and very valuable. thank you man for all those efforts :>
Great video, its a been a huge help for an upcoming interview. Thank you
Did you get the job?
@@AccuraCast Unfortunately not. Over 200+ people applied for the role. I was one out of 10 interviewed and they didnt take anyone out of the 10 and put the ad back up. Despite that, your video really simplified one tasks for the interview, so its much appreciated. Thanks
Awesome stuff brother
Hi, great video. No need to put the billing information? And if i put how much will charge on the card? Thanks
You will need to provide billing info when you set up the GTM Server container via Google Cloud Platform. You can use their cost estimator to see if you'll need to pay.
This was great and to the point! Do you have any videos showing how to stop sending the events that are not setup for Facebook to Events Manager?
I hope you can see and help me in my question sir. thank you so much
Great video, thanks a lot! Only one question, do i need to add the event ID variable to my Facebook Event tags also? To make sure they dont "double count"
Yes, absolutely. The Event IDs have to match for the Pixel and Server event, as that's how FB knows to deduplicate the same event and ensure it isn't double-counted.
Hey there I’m hoping you could possibly give some advice and insight on three specific questions.
Since post IOS as you’re already aware has caused data loss in ad reporting.
To address this I’m using CAPI which I hired someone on Upwork to help me set up using google tag manager for events to be sent through a server as well as my browser.
Which has worked to send all of my events including purchase events to Facebook.
But the problem is, even though Facebook is receiving the purchase events which I can see being tracked in the events manager…
For some reason only some of my purchase events are being reported back as conversions in the ads manager, and I’m not able to get accurate data to know which campaign or ad set the sales are coming from.
So with that said I have some quick questions I’m hoping you can help me with…
1) Is there anything else I may have missed that is causing Facebook to be unable to link the purchase events to the ads in the ads manager reporting?
2) Does running ads without the data being picked up properly by Facebook “dumb down” the Facebook AI resulting in an impact to all my ads and future ads I run?
3) How do you determine to scale the correct ad sets when not sure which ad sets are doing well due to data not being received accurately in Facebook?
Facebook is facing trouble with attribution post iOS 14.5, so quite a few advertisers are reporting similar problems. To minimise this you can:
Ensure you're sending fbclid (fbc) when present, improve your match quality, and use advanced match for Pixel events.
Best one for present day! Thank you a lot!
Just did like you shown, and it works. But when i test my server side events at Event Manager - i can see only 2 params (value and currency).
but i sent more.. Like content_ids, some custom events, content_type.
Is it normal? i can't get it
No, that's not normal. You should be able to see all the parameters you sent. If they aren't showing, chances are you've formatted the values incorrectly.
This video was excellent, it helped us a lot, thank you!
We now have CAPI working great. However since adding the transport URL our GA4 analytics is no longer recieving data. Do I need to set up a secondary GA4 configuration tag without the transport URL for the analytics page?
The transport URL stops your data going directly to GA4. So you either need to send it to GA4 via your server container, or duplicate your GA4 tags on the web container.
@@AccuraCast hi do you have any video? or could please guide how to do this I am also facing the same issue.
@@PhaniNirola have you duplicated your GA4 tags, as explained in the comment above?
@@AccuraCast Yes done that... created a new GA4 tag firing for all page views...Thanks for the response...:)
Hey - I notice that in your GTM web container there is both a standard GA4 tag and a SS GA4 tag. Are both tags required for the setup? Just concerned about duplication of standard events.
You don't *require* both tags. However, we use GA4 web to send signals to GA4 & use GA4 server for Meta CAPI and to send signals for the most important conversions to GA4 (along with deduplication parameters).
Hi
I don't understood how can we create the Variable {{Transport URL}}
I got the appspot link in the Server created by Google for my GTM Server account. But idk where's the type of variable that we need create, got it?
If u can help us in Brazil :)
The Transport URL can be a variable of the type "Constant" - this remains a fixed value, which will be the appspot link.
PS: Remember to use a custom domain name eventually, because the appspot link won't count as a first-party when third-party cookies get blocked.
I used a client side account with a webhook end point sending information from the browser to the webhook, cheaper than server side :)
You still need to host the webhook end point somewhere, and then code how the webhook handles the info it receives. This could work out well, especially if you have spare server capacity and can code the connection between your end point and CAPI.
thankyou for tutorial! , i have question, currently i dont have google cloud for server, but Now i'am using Vultr as hosting which is my domain stick in it. So if i chose Manually provision tagging server on container setting, and then code Container Configuration generated. and then what should i do next ? where i should put that code?
Manual server setup on GTM tends to be a lot more complicated. You need to follow the instructions provided by Google: developers.google.com/tag-platform/tag-manager/server-side/manual-setup-guide. If you run into issues when following the steps provided by Google, you'll need to either contact your server provider for support or pay experts for this.
Hi! How do it for connecting the google tag manger in my site in html? I follow this tutorial and my code show just a long code key and not code default with script.
This guide doesn't cover setting up GTM in your site HTML. You need to have already added the GTM code to your site, set up basic events, and then pick up from there.
thank you for the instructive video!
is it correct to implement the single FB events like Purchase, addToCart and so on via a GA4 event tag? For example "Event-Name" (Purchase) with the event parameters "Value" and "Currency"? Do the event-name have to be written like in the GA-4 documentation (e.g. "add_to_cart") or like in the FB documentation ("addToCart") to be recognized? i hope you understand my question!
the already existing Custom-HTML FB-Events remain and will be fired anyway. correct?
One last question about the event id. Is this a random id? does this also need to be added to the pixel-events (custom-html) so FB doesn't double count an event?
thanks a lot
That's a great question!
The official Facebook GTM integration recognizes both Facebook and GA4 equivalent events, so for most standard cases you can use either i.e. add_to_cart or AddToCart.
The existing Facebook Pixel events should be kept in, and fired as normal. You should setup an event ID that's sent to *both* the Pixel and server to enable deduplication of the two (Pixel and server) events. The Event ID can be any random ID, so long as it's unique to that event.
@@AccuraCast any chance of you creating a video walking through setting up the eventid on the pixel/browser side?
@@scottmcconachie305 Sure... that does seem to be a popular stumbling block for many, so we'll create a video walkthrough for Event IDs. Please subscribe to the channel to get notified when this is up.
@@AccuraCastmany thanks! i would also find a video on the implementation of the event-id (pixel/server) useful.
@@scottmcconachie305 the video for event ID setup is now live, and linked from the top comment & within this video
Thanks for the helpful video! Hope you can help with one question please. I have my CAPI working so that browser and server events are successfully deduplicating. I have custom parameters for 'Time on Page' and 'Scroll Depth' events. These custom parameters (ie scroll_depth = 50%, time_on_page 60seconds) are appearing in Events Manager testing for the Browser Events, but not for the Server Events. If you are able to suggest any guidance I would be grateful!
If you are sending them to the server container, they should work, just like any other event. However, one thing to consider is whether you really want to track these events as conversions, especially when you are allowed only a limited number of conversions under Aggregate Event Measurement.
@@AccuraCast The event is being sent via the server. However the parameters are missing within "Test Events" entries. In the GTM outgoing HTTP request body in the server container I see the event name, ID and standard parameters detailed. However for custom_data I see "custom_data": { "contents" : null}.
If I test via a payload using Graph API Explorer, the parameter shows. So I'm assuming it must be something wrong I'm doing in GTM.
@@richardisaac1941 the official Facebook template on GTM server doesn't do a good job of handling custom parameters if they aren't defined. You might need to tweak that to enable it.
@@AccuraCast Thanks - what do you mean if they aren't defined? I originally started with Custom HTML tags but then switched to Facebook templates
@@richardisaac1941 *if they aren't pre-defined in the official Facebook GTM server-side tag template - you can dive into the code under the templates section, and see which parameters are processed and passed through.
Do you have a tutorial on how to deploy your own server through others providers (AWS or DO) to host GTM ServerSide?
Great suggestion. We might make a video about this, but probably not for a few months.
It's not showing for me Google Analytics: GA4 Configuration. Do you know why? Thank you
Are you looking in the web container or in the server container?
Thanks for the video. Q. If I implement the cAPI through the server-side, will I be able to report ios 14 events back to Facebook?
Yes. When you're tracking server-side, you will be able to report events that happen on your website irrespective of whether or not iOS 14.5 users have opted out. However, the attribution and audience matching may not be perfect for users who opt out.
@@AccuraCast Thanks for the great video. However, after following the instructions to a tee (minus event IDs since I'm opting to only send server-side), events from iOS 14+ devices aren't being sent. Any advice?
@@imthekiller00 have you set up a custom domain or are you using the default appspot.com URL for your server container?
@@AccuraCast Default because it's a sandbox website. Is that the issue?
@@imthekiller00 if you use the default URL, that counts as a third-party, which will then be blocked. If you want the cookie to be counted as first-party, the top-level domain of the tracking server must match that of the domain being tracked.
Thank you very much for the very helpful video.
I have a QUESTION: I created/Installed automatically Facebook API. All these steps are set up in GTM itself but it is differently configured than in this video tutorial. I can I understand it is correct or not. any recommendations? if I delete everything and set up again. will it have any effect on Facebook even
Your best option is to test the implementation and see if it works. If it does, and if events deduplicate correctly, you don't need to change the setup.
If you find it doesn't work, then you might need to either troubleshoot it - if you can identify where it's going wrong - or start from the beginning with the steps provided in this video.
Hello, do you offer set up services for CAPI - I've got most of the things ready but some of them are not clear to me. Would pay a full price for this.
Yes, we do offer services for CAPI. You can contact us via our website for further info.
Do you have any tutorials that break aspects of this down Im quite new to both GTM and server side. I couldn't understand what all of the fields to set are for in the GA4 config also do I need to add the transport URL when I've used the send to server container option and put it in there I don't think I had seen that as an option in your video?
I've tried creating a purchase event using a ga4 event linked to my config, Ive put the event name as purchase, and even though the trigger is successfully firing it isn't being picked up by my server. Its only picking up the pageview events and not the purchase event I've got everything else the same as you've shown I don't understand why it isn't being picked up.
The send to server option was released just after this video, so if you're using that, you don't need to specify a transport URL - it does the exact same thing.
There could be a number of reasons why your purchase event isn't being picked up. Most importantly, have you linked it to the GA4 config with the correct server container? If so, check the event received data in your server container's preview.
We don't have any other tutorials on GTM - there is one about the event ID setup, though. Have you seen that?
@@AccuraCast Thanks for your response, that makes sense with the transport URL.
Yes I linked the events I've tried to the GA4 config, with the config having the exact same settings as yours on the video.
It is picking up a pageview event as default but nothing else seems to be picked up for some reason even if the events trigger is fired on the web container.
@@DoomCatcher the PageView most likely fires from the config (if you've left that as default). The other events need to tie into the config, so it's most likely a problem with the other event not getting sent to the server container correctly. You can inspect the tag fired on the Web container to check if everything's in order there, and then you can the inbound info on your server container, to see if something's blocking it there.
@@AccuraCast Thanks again for the information, I can't see anything from the events going into the server container other than what is sent by the config.
Are there any special requirements/parameters for particular events such as a purchase event to be sent even to just a server. It isn't making any sense why it isn't working.
I don't know if you take content requests but if you do a more in-depth video on how to set up events, expanding on this video would be greatly appreciated.
@@DoomCatcher thanks for the suggestion. We can look into this, but it might be a tough one, since the process, variables etc. differ from one system to the next.
For your issue, check preview mode in both the server and web containers simultaneously, and see if the web container is sending the event, and server container receives it (in the incoming events tab).
Question: You don't explain how to set up additional events - do i need to set up BOTH a GA4 event tag and a Meta Pixel event tag, if I want to create an event for a purchase (just for example).
If I understand your video:
GA4 event tags will send to the server, where events are received by the Facebooks CAPI tag.
Meta Pixel event tags will send data straight to Facebook, via pixel
So as i understand you, you DO need to have 2 tags per event, right? One GA4 Event, and one Meta Pixel event tag
I´m grateful for your video. I was reading your answers to previous comments on this video in which you said GCP offers a free tier and you refered a Google webpage. I visited it but I don´t know how to traslate what Google says about thresholds of its free tier (about all their cloud services) to what is needed for the configuration of FB CAPI through GT manager. Let´s say my website it´s going to have 1000 visits/month and that could generates 3000 events, how could I know if that is covered with GPC free tier or how much will be the cost, could you tell me please.
And I have a different question, is it possible to configure the GTM web container to send the events to Google Analytics instead of the GTM server container? most people are now setting up sending events to Google Analytics from the server side, I don´t know if there is a reason for that
The cost is like to be very low (< $10), if not zero at that level of traffic.
And yes, you can configure the GTM web container to trigger Google Analytics events, but that's not the same. You should be doing both... sending Web and server events to GA4 to maximise coverage.
Min 2:40 , there is no "Generate access token" link in my events manager. Everything looks the same but this one link is missing in my version. I don't know how to proceed.
Do you have full (admin) access to your Pixel?
I was able to trigger any event but purchase! Any clue on what's happening? Even when it's not a standard event, it shows as custom event on facebook. Purchase don't even pass through. In preview, it shows tag fired, but when i open, it shows firing status: failed
Are you sending a value & currency with the purchase? CAPI tends to reject purchase events without those. For the rest, ensure you're using the exact nomenclature (it's case-sensitive) otherwise it'll get counted as a custom event.
I don't have a Facebook conversion API tag on my GTM, where can I search?
The Facebook conversions API tag is only available on GTM Server containers. Have you created a server container? Within that container, you'll see the tag listed when you click to add a new tag - you might need to look in the Community Template Gallery
Hi Dear thanks for very good explain but can you explain me more about the Data implementation
The data implementation will vary vastly depending on the website systems in use. If you can share more specifics on here, we might be able to create a follow up video that covers general principles.
You can also get in touch via our website for a price quote if you need help with this part of the implementation.
@@AccuraCast My website is based to wix platform and i don't have any plugin for do the Facebook CAPI implementation so I will use GTM for do it and I think can do it but I don't know how to set a correct parameters of data layer for the events ( page view, view content, add to cart, begin checkout and purchase ) that I will track and send to the Server. Please there are any explain for do this or can I receive helping for do it?
@@mdimartina have you looked at the official guidance from Wix: www.wix.com/velo/forum/coding-with-velo/how-to-push-data-into-google-tag-manager-s-datalayer-from-wix
I installed everything, and it works fine! but how to hash the customer data sent to facebook conversion api because as you know facebook impose the customer data to be hashed before sent to them?
The Facebook CAPI client template for GTM server automatically hashes user data for you, so long as you use the pre-defined variables correctly.
@@AccuraCast yeah, I think it not a problem anymore. But What’s is the tag firing sequesing should we use for purchase pixel and ga4 tag with ga4 config tag? Pleaaaase this is my last question Farhad! Thank you so much
Should we fire the GA4 config tag before other tags? Because I noticed that the Purchase event doesn’t be sent when the GA4 config tag is fired before the GA4 purchase tag.
@@ibnouzahirmohamed1852 There isn't a pre-defined / required sequence. You'll just need to link your GA4 Config tag to the GA4 Event tag when you create the latter.
@@AccuraCast I’m thankful for your help. Just perfect. I passed weeks (2 months on youtube trying to understand Gtm server tagging with fb ads and I watched your video many times and I found a lot of valuable informations and guide in this. Thank you so much for the great efforts.
How i connected the container in server? Is necessary?
Either via the Transport URL or the new "Send to server container" feature on the GA4 config tag
Got lost at the set up for SS-GA4 Config directions. I only see Google Analytics: GA4 and Google Analytics: Universal
Are you looking at the Web container or the Server container?
@@AccuraCast Im think web container if that is the "older technology" I can't afford the monthly fees with Server side cloud controls so Im guessing the other one. I may have found the answer. Thanks for responding.
@@edferrigancoaching you can't implement CAPI without implementing a GTM server container with GCP or some other server provider.
GCP has a fairly good free tier, so it might not be expensive.
@@AccuraCast Seems like it said $300 after the first 90 days.
@@edferrigancoaching you've probably misread that. Don't they offer $300 credit for the first year or so of trial?
Can you help me to set up a Facebook Capi set up
We charge for technical support services. Please contact us if you'd like to get advanced support on CAPI setup.
How do you get the event ID variable?
The easiest way to do this is to set your event ID in the data layer, and then pull that into GTM as a data layer variable.
@@AccuraCast thanks for this video - could you suggest the best way to pull the event ID into the data layer?
@@codarity-agency simple JavaScript data layer push will do it. We're creating a video tutorial specifically for event IDs, so stay tuned for that.
@@codarity-agency we've put up a video for event ID setup, so that should help answer your question
Why do you need to put billing information? in the future please provide information if what you're showing will cost to set up or not it is very frustrating. This for me was also far too rushed for someone who has little experience with GTM mostly around setting up the variables and triggers.
Google Cloud Platform has a free tier and you need to pay if you use beyond that. You need to provide billing details in case your traffic and data processing requirements exceed that free tier.
Gtm server side is it free?
Yes. GTM Server side is free. But if you have a lot of traffic, you might have to pay for hosting fees on GCP or some other cloud hosting service.
Someone here can help me to do all the steps correctly? I can pay for helping me.
Thanks for reaching out via WhatsApp Business. We can help you - discussing further on there.
ensina em portugues
It started off alright, but then halfway through I came to realize this is far too advanced for me. I don't even't know what I'm doing LOL.
It shouldn't be... Maybe just go slower, and follow it step by step. GTM is one of the easiest integrations outside of native, in-built integrations on the platforms and CAPI Gateway.
Unfortunately, this is a paid service. From Google itself:
"To sum up, the price of server Google Tag Manager hosted in Google Cloud will be:
Minimum $120/month.
For websites with higher traffic and tags, the price will increase to $240-$300/month.
Logs will cost additionally $100 for 500 000 requests."
It will be a good idea to mention such "insignificant" details.
Not sure which website you got that info from (please share a link to your source), but it's false. There is no minimum cost - GCP has a very generous free tier, and when your traffic crosses that free tier, you get billed according to usage.
You can read the details on
developers.google.com/tag-platform/tag-manager/server-side
And you can read more about the Free Tier eligibility at cloud.google.com/free/docs/gcp-free-tier#free-tier