April 5, 2020
Facebook Pixel Purchase and Conversion Tracking with GTM | Part 3

Facebook Pixel Purchase and Conversion Tracking with GTM | Part 3


– In this video we’re gonna
find out how we can do conversion tracking with the
help of Google Tag Manager and send that information
onto our Facebook pixel. All the more, coming up right after this. (bouncy, bass thumping beat) Hey there and welcome
back to another video of MeasureSchool.com,
teaching you the digital way of digital marketing. My name is Julian and in this series on Facebook pixel tracking, we have already discovered
how to set up our Facebook base tracking pixel,
send in page views and events, and now we need to take care of the most important interaction
that a user can take on your website, which is
commonly known as a conversion. Now, that might be a page
that your user should visit or a certain interaction
that he should take, but there’s actually more
information that we can send over to Facebook, like the
value of the conversion. So we can optimize our
ad campaigns towards that and then later see that
in our ads interface. So it’s crucial that we
set up conversion tracking and purchase tracking
correctly on our website and now I’m gonna show you how to do this with the help of google tag
measure, so lets dive in. Welcome back to our demoshop, in our last video we
have already installed our Facebook base pixel, which
you need to have installed in order for the other
interactions to be picked up. I re-installed the pageview event and the add to cart event
on button clicks off the add to cart button. Now, one thing that is missing, which is very important for Facebook ads, is actually the purchase tracking so if you go to setup, we will go with our menu
installation right here. We have already installed
this Facebook base pixel code on our page and if you go to continue, we have our custom events. Now, we already talked
about our add to cart event, what I wanna go over
is the purchase event. Now for the purchase event, you simply also need to
deploy this tracking code, but what will make your data much better is if you have a conversion
value for example 99 dollars, and currency, which is
usually your not changing, but could be dynamic as well. USD in here, so the code gets a little bit longer, now obviously, not all of
our purchases should be marked as 99 dollars. You
would need to dynamically insert this with the help
of google tag manager. So just to give you an example, lets go back to our
demoshop and buy a product, so in any online store, you would go and land on
an order received page, or a thank you page,
where you would normally see how much you have spent in your order. Now this is obviously the amount that we want to send over to Facebook and dynamically fill into this
event that we sent to Facebook. How can we get the amount into Google Tag Manager dynamically? Well there are different methods and we have discussed them in a
video about conversion values which you can check out in the cloud or in the description below. The most robust way is to
build a custom data layout. Now since I’m here on a (mumbles) store, I’ve installed a plug-in by Thomas Geiger, which is the Google Tag
Manager for Word Press Plug-in. Which will fill the data
layer for you automatically if you are on a website. So in
order to see the data layer, and where the information actually is, we need to enter our
preview in the work mode. So lets do that first and I will need to go through
another conversion here. And once I’m back on my thank you page, I can look into my data layer, and see how it was filled with values. So in our case, we have
this huge data layer push, which is the GMT4wp order completed EEC and as we can see, we have
a transaction total in here, which resembles the total amount
that was bought by the user You also have a transaction
currency in here, which you could also use if we had different currencies in our store, in our case, that doesn’t really change so I won’t pull this from the data layer, I’m just gonna try to pull the transaction total from the data layer. To do this, I will build a variable, now variables are like place holders, so you can build them
dynamically to pull them from places like the data layer. I will choose as the variable
type, a data layer variable and this will allow me to access the information from the data layer. Give this all a name. And the only configuration is
the data layer variable name. That is the key that we see
in the Javascript object. So in our case, it will be
transaction total, right here. I’m just gonna copy this and put this in and once I have this in here,
I can just click on save and I have this now available
in my Google Tag Manager as a variable. What
does that actually mean? Where can we use them? Well
now, we can go to the next step and actually copy our Javascript code here and implement this as a new tag. This will again will be a custom html tag. first of all, give it a name. And as the html, we’re
just gonna paste this in. Now we need to customize this again, we don’t want all our
products once this files actually result in 99 dollars. So we will dynamically
insert our variable, which can be done with two curly brackets. Now this opens up a menu with
all your different variables in here, so we can just click
on our dlv transaction total, and that should be
replaced dynamically with whatever is in the data
layer at that time. Next, we can build a trigger and we want to deploy this on
our final checkout page, so we could for example, look
at the url up here and say, we want to deploy this on
our order received page if that’s under your…it’s
pretty easily built, We’re going to plus here
and creating a new trigger, we will file this on the page view tag of our thank you page. And this will be my page view tag, but only find on some page views, where the page url contains
our order received. Lets save this, save our
Facebook purchase pixel, refresh our page and check this all out, lets go back and go
through another conversion. And we get to our order received page, we see that our Facebook
event purchase pixel filed and in our Facebook pixel helper, we see that purchase
information was transferred with the value of 45. In this corresponds,
dynamically was inserted through our variable with the amount of 45. So this seems to work fine, lets head over to our Facebook analytics, and go into the event debugging, and also here we see a
purchase event that was filed with the value of 45. Now in Facebook itself, we could use this for
our custom conversions, so you could create a
new custom conversion where you choose our purchase event as a custom conversion and
once you have that set up, you will be able to get columns filled, like in the ads manager, that correspond to the conversion
value of your campaigns. So if you have a campaign here, you should be able to see
the actual conversion value, in a column, that you can
add here in your ads account. So that should be filled with
the amount that is transferred later on, which will give
you much greater data on how many clicks did you receive and how much money did
you make in the end. So overall a really great data set that you should have in your account. Now don’t forget, this is currently just
running on our browser. We still need to deploy this as a version, so to do that you can
click that submit button, enter descriptive name, and publish this to all your users so it’s live on your website
and there hence falls, will be tracked with their purchases. So this is how you can install Facebook pixel tracking for purchases. Alright so there you have it, this is how you can set
up your purchase pixel with the help of Google Tag Manager. Now this is already the
end of this little series on Facebook pixel tracking,
if you have any questions, then please, I’d love to hear
from you in the comments below we always have great discussions there, and if you haven’t yet, then please, subscribe to the channel right over there because we’ll bring you new videos, just like this one every week. Now my name is Julian,
see you in the next one.

47 thoughts on “Facebook Pixel Purchase and Conversion Tracking with GTM | Part 3

  1. Hi Julian, thank you for doing excellent videos and sharing all that useful information with us. I have a question linked to the FB pixel: If someone in Germany installs the basic FB pixel on a website, the website owner needs (for legal reasons) to offer the website visitor the possibility to opt out of the FB tracking. Once opted out, the FB pixel should not fire again when the user comes back. Is there a way to do that too in the Tag Manager?

  2. Hi Julian, I followed all the steps you told and everything was working perfectly fine excepts i am unable to get the dynamic value of products in facebook pixel helper. I dont why it is happening. kindly help.

  3. Hey, Julian. Thanks for the wonderful video series! Each video was really insightful. I have a quick question that I'm hoping you can help me with… Is it possible to see if a person who viewed/was shown your ad converted? For example, someone I'm targeting is shown an ad. However, they don't convert at that moment through the ad funnel, instead, they visit the website on their own a week or 2 later and then purchase. Is there a way to see that information? Thanks for the help! You've got a new fan in me.

  4. Hey Julian, what steps are required for the dynamic "transactionTotal" variable. We have installed Google Tag Manager for WordPress and enabled at the Integration "Track enhanced e-commerce". On our Preview GTM the price is shown next to "revenue" and not "transactionTotal". Can we use the variable "revenue" too, to set up the conversion tracking? Please be so kind and help us. Thanks for the awesome content!

  5. Great Video, thank you very much. Cold you give a hint, how to get access to the data layer when using shopify.

  6. Hey Julian, if I have integrated facebook pixel with GTM from facebook business manager's integration, do I need to continue adding custom Tags for specific events like in this video?
    I want to be able to add conversion values, do I need to setup custom tags for those?

  7. I didn’t see that extra code to add to my purchase page. I used to see this a long time ago but when I set my events up the other day there was only 1 main code for the whole site. Did i miss something or did they change it? My website provider doesn’t allow me to alter the purchase page or the payment page either and i still cant get those events to work

  8. What if we are using a non-WooCommerce and/or non WP page, is there an easy way to get transaction information into the GTM DL or something to pass to FB and/or GA? Thanks!

  9. I still experience difficulties with conversion tracking. My Pixel only registers 40% of my purchases, do you have any idea how i can solve this? I am using Shopify..

  10. at the end, you say that "You could create custom conversions here…." , after setting up the purchase pixel and stuff within GTM, why do I have to set up custom conversions in FB aswell? Isn't it tracking right off the bat, as everything is set up in GTM, is it? Thanks in advance!!

  11. Hey, Julian. Thanks for updating all old videos as soon as a better method is available for doing the same thing. I noticed several videos where you have installed "gtm2wp" plugin to have a WooCommerce data layer automatically created for you that you can see in GTM preview/debug mode. I have already installed GTM and various tags following your instructions without using this "gtm2wp" plugin. Now if I decide to install this plugin does it mean I will have to manually remove the GTM code I have already pasted in header.php and loose the already created tags and triggers since this plugin will install GTM automatically again during installation ? Can I use this plugin to only create the WooCommerce data layer but keep my original GTM code/tags/triggers/variables etc?

  12. Following the video used gtm4wp plugin to have my dataLayer created for WooCommerce. Created the same dataLayer variable, tag and trigger you created.
    Result: Purchase event was recorded in preview/debug mode but missing in Pixel helper where only "Page view" event was logged. "Event debugging" doesn`t show it either.
    At "Event Manager" I have an issue reported saying "One or more of your Purchase events is missing a value parameter. This may affect your ability to see return on ad spend calculations".
    My dataLayer variable is "transactionTotal" as on the video. Trigger is also "URL contains "order-received"
    Where the issue might be? gtm4wp configuration or else?

  13. Hi there! I installed the GTM for WordPress plugin like you suggested, but does it matter if you have GTM already installed on the backend of your website and then place your GTM ID code into the plugin — so, essentially, you have GTM installed twice on your website? Is the GTM ID required for the plugin to work properly? I'm really only looking to use the plugin to track the data layer like you demonstrated in the video. In the plugin, for code placement, would I just choose "Off (only add data layer to the page source)" in this case so it doesn't install GTM twice on the website? Thank you!

  14. Hi! I've already installed the conversion tracking with GTM but after a test there's an error shown on the FB Pixel Helper:
    "Purchase WARNINGS:
    We detected event code but the pixel has not activated for this event, so no information was sent to Facebook. This could be due to an error in the code, but could also occur if the pixel fires on a dynamic event such as a button click."

    Could you help with that? Thank you!

  15. Instead of "transactionTotal", what if you have to target one of the child items under "ecommerce" such as "affiliation"? How would you enter this into the Data Layer Variable Name field?

  16. First thank you very much for all your very useful videos 🙂
    I have question. If we only use google Analytics for analyse audience and if we have already set the tracking of conversion value for Google Analytics with GTM. We don't need to set this kind of tracking, right ?

  17. PLEASE PLEASE PLEASE can anyone help its with shopify and facebook pixeL . ive set up shopify pixel and its working installed perfect the facebook ads manager the view content view page initiate pixel is working. the pixel helper says its good. problem.what i need is how to set up purchase pixel and add to cart when manually encode pixel yourself where to copy and paste it to i have no idea im new

  18. Let me tell you this, I got a free subscription on skill share for 2 months. You explain things waaaaaaay better for free. you are great buddy!

  19. So if we have the facebook base code, and we want to put a purchase event code like this one:
    <script>

    if (document.location.href.search('appspot.com') == -1) {

    fbq('track', 'Purchase', {

    content_name: 'ccispurchasefu',

    value: 49.95,

    currency: 'USD'

    });

    }

    </script>

    We do not modify any 'tag priority' or 'tag sequencing' options?

    thanks

  20. Why did u make the purchase event into a custom conversion because the purchase event is already a standard event so it will automatically turn up in the reporting ?

  21. Nothing about tracking the individual products ordered, only the total revenue? That doesn't help for remarketing campaigns.

  22. Great content!! thanks for that! Question. Do you have a video to set up tag that measures the time spent for a visitor o a specific page(s)? Thank u!

  23. Hi julian and thanks for all your lessons))
    I have some issues with missing content ids/view content ids on my facebook catalog.
    I have a client with more rhan 600 products on website.
    How can i configure all ids for those products?
    There is some way to solve this?
    Thank you

  24. Great video! I was wondering if you could clear something up for me. I want to run a conversion optimized campaign and use the standard event – purchase. But my store has various different type of products (cat tshirt vs dog iphone case). Will the facebook pixel be able to segment between these two users groups?

    If so, how do the ads identify ahead of time which segmented audience group to pull data so it can optimize for that specific product (cat tshirt)? I'm putting a link to the product in my advertisement's comment section. Does it determine what data to use based off the link URL placed in the ad comment section and identify it that way or do we manually assign what data to pull from somewhere?

    If not, does that mean it will use all the purchase data from my general website, regardless of product type/category/sku etc.? In this case, would I use a custom conversion to hone in on that one product type? What do you recommend? thanks!

  25. Awesome video! question, why do you have to put the fb pixel code in the google analytics? for you to customize it such as the dynamic pricing?

  26. Hi, can you target the purchase by product type in facebook pixel? like whey and BCAA and able to make a pixel segmented ?? to remarketing to people who bought this product, or excluding those buyers from campaigns for a particular product?

  27. Julian great video! First question. Do you have a Patreon account that we can contribute to? I love your resources and I would love to contribute so you can continue making great videos! Question 2. I am having a similar problem as others where I am not able to pull in the value. I am using the same variable that I use for Google Analytics ecommerce tracking that is working properly, but when I fire this event I am getting the value 'google_tag_manager["GTM-XXXXXXX"].macro(17)' instead of the transactionTotal.

    When I view the event in debug mode, the results I get are:

    '<script type="text/gtmscript"&gt;fbq("track","Purchase",{value:google_tag_manager["GTM-XXXXXXX"].macro(17),currency:"USD"});</script>'

    Any idea why this is happening?

Leave a Reply

Your email address will not be published. Required fields are marked *