BACK

how to add purchase event code to shopify

How To Add Facebook Pixel To Shopify With Custom Coding what's up everyone today we're going to be 

Molendijk Media

Updated on Feb 03,2023

How To Add Facebook Pixel To Shopify With Custom Coding

The above is a brief introduction to how to add purchase event code to shopify

Let's move on to the first section of how to add purchase event code to shopify

Let TThunt's experts help you find the best TikTok product on your Shopify business!

Find TikTok products (It's Free)
No difficulty
No complicated process
Find winning products
3.5K Ratings

WHY YOU SHOULD CHOOSE TTHUNT

TThunt has the world's largest selection of TikTok products to choose from, and each product has a large number of advertising materials, so you can choose advertising materials for TikTok ads or Facebook ads without any hassle.

how to add purchase event code to shopify catalogs

How To Add Facebook Pixel To Shopify With Custom Coding

what's up everyone today we're going to be  going over how to install the facebook pixel  ,on your shopify drop shipping store now i know  you may be thinking about something that's very  ,easy john why are we going over this and the  reason is because i'm going to show you how to  ,install it without the new update of having  to use this annoying facebook sales channel  ,so if you've seen the new update you have to  go through and you have to register a page  ,an ad account and a pixel all under one store  on the facebook sales channel i really don't  ,like this because i don't like specifying  one pixel one page or one ad account to one  ,specific store i want to give facebook  as little information as i possibly can  ,so what we're going to do is we're going to  set it up manually what we're going to want  ,to do is go into our facebook business manager  once you're inside your business manager you  ,just go ahead on these dots for the business  tools and we're going to go to events manager  ,once you're in events manager basically what's  going to end up happening is you'll have all the  ,pixels that you've already created lined up right  here they're all blurred out because i don't want  ,to show the pixel ids but you'll have them all  there and then you can also go through and you can  ,create new pixels they are adding limitations now  on how many pixels you can have per ad account but  ,that's not a huge issue just go ahead and create  a pixel then what you're going to do after you  ,create your pixel is you're going to want to go  ahead and go into this overview section right here  ,so inside the overview we're going to hit continue  pixel setup over here this is where you can do the  ,partner integration with shopify but that's not  what we're doing today instead we're going to  ,be going ahead with the install code manually so  when you come through here you're going to notice  ,that it tells you what to do so the first thing  that it says is you want to copy your base code  ,and then this little section will pop up where  it says paste the pixel code into the bottom  ,of the header section just above the head tag so  what we're going to do is we're going to go ahead  ,copy this code and then we're going to go into  the coding of our store on the back end and we're  ,going to implement this coding into the header  of our store we want to navigate over to online  ,store click on your themes and then inside your  themes you're going to go ahead and find the theme  ,that you currently have active in that theme what  you would want to do is you want to click action  ,and then go ahead and hit edit code whenever  you're doing code edits or whenever you're  ,doing modifications to the coding of any website  i always recommend instead of editing your active  ,theme the one that you're currently using make  a duplicate of that theme and do the code edits  ,with that one so you can make sure everything's  working good before you publish it and make it  ,live so we're going to go ahead and make sure  that we have a duplicate theme that we're doing  ,this edited once you're in the theme you're  gonna notice all of this different coding in  ,different templates and it can be different for  the different themes that you have but this one's  ,gonna be for the debut theme and it will be very  similar for the majority of themes so it should  ,look something like this what we're then going to  do is go ahead and navigate over to theme liquid  ,in here you're going to see all this  different coding but as it showed over here  ,we want to paste this just above the bottom head  tag so if we come back over here you're going to  ,notice we have a head tag right here and then we  also have a head tag down here if i can find it so  ,we also have the head tag down here so basically  what it wants us to do is place this coating  ,directly above this head tag right here we'll go  back over here and we'll go ahead and copy the  ,code then back over on our store what we're going  to do is we'll just hit enter and then we're going  ,to go ahead and paste that in there so this coding  is just the pixel base code the next thing that  ,we need to do and this is why you need to watch  through this entire video to make sure that you  ,see all these little steps because if you miss any  little steps the coding will not work correctly  ,and you're not going to get all the events  that you were expecting to come through on your  ,facebook backend so now that we got the base code  installed back over here in the pixel setup we'll  ,just hit continue then in here you have the option  to turn on automatic advanced matching which we do  ,want and we want to go ahead and check all of  these because this will just give facebook more  ,information to create better audiences and better  targeting off of so this right here is the next  ,section and this is where things will get a little  bit more detailed and a little bit more tricky  ,and it can go even more detailed and more tricky  depending on how advanced you want to get with  ,your coding but we'll do some simple types of  coding and this is where you're going to go ahead  ,and set up your events so what we're going to do  is we're going to have this option right here it's  ,an event setup tool we're just going to go ahead  and click that so once you're on your website what  ,you're going to be able to do is create custom  events that you're actually going to want to  ,go ahead and track so when you're going through  make sure that you're doing this all correctly  ,because you want to make sure the events are being  tracked and of course once you set it up make sure  ,you test these events test them to make sure that  everything's working before you actually implement  ,it all onto your live store so once we're here  you're gonna notice you'll have this little box  ,that will come up and you can do track url or you  can do track new button so when you're wanting to  ,get a little bit more advanced you can actually  go through and track different urls but we're  ,going to keep things relatively simple and just do  track new button you're going to notice when this  ,happens it's going to populate all these different  things that it thinks you can go ahead and you can  ,track so right here what we're going to do is  we're going to go ahead and click on add to cart  ,and then after we click on add to cart we're  going to go ahead and label this with an event  ,that happens whenever someone clicks add to cart  so of course add to cart in here you can tell what  ,the value is and what the currency is but since  it's just an add to cart and because there's no  ,actual value attached to an add to cart it's  just an event we're going to go ahead and just  ,leave that and hit confirm after we do that the  next stage that we would want to do is of course  ,initiate checkout on the initiate checkout page  the same thing we're going to do we're going to  ,hit the checkout button and then we're going to  go ahead and add an event and do initiate checkout  ,this again we're not going to add a conversion  value because there is no conversion value it's  ,just an event so we are all good to go with that  back here on the pixel event manager what we're  ,going to do is go into the settings tab and then  inside the settings if you scroll down you're  ,going to notice you have the advanced matching  which we already turned on but on the back end you  ,just want to make sure that these are all still  on then if we scroll down a little bit more you're  ,going to see this thing that says track events  automatically without code we do want to turn  ,this on because what this is going to do is it's  going to let facebook go through and automatically  ,find different events on your website that occur  we want to let the pixel go through and crawl  ,the website and collect all those different data  points so once you've got add to cart set up page  ,views are all good to go initiate checkouts are  all good to go the only thing that's left is your  ,actual purchase events so when you come back into  here and you're doing your event setup tool system  ,you can hit track a new button and then you  can go into events and you can select purchase  ,when you select purchase what you can do is you  can actually select this option which is choosing  ,the value from initiate checkout this is a great  option if you're not doing custom conversion  ,values or if you're not getting a little bit  more specific because what it's going to do  ,is it's going to draw the total cost from your  initiate checkout and it's going to apply that  ,as your conversion value so this is a great way  of setting it up but you're going to notice that  ,once you get to this section if you try to go to  your checkout process and do this event setup tool  ,it's not going to be possible and the reason for  that is because you can only edit your coding  ,for the checkout if you have a professional  shopify plan so when it comes to custom coding  ,and setting this up you would need a professional  shopify plan that will give you access to the  ,coding on the back end of your shopify store  where you can go ahead and you can start editing  ,the checkout coding and implement your facebook  tags using this event setup tool with the purchase  ,event this is definitely something that you  would want to use if you're taking things a  ,little bit more seriously or if you're operating  and trying to get a little bit more technical  ,but if you're trying to keep things simple  and basic use the automatic setup and if  ,you do decide to use these methods make sure you  duplicate your existing theme do all the edits on  ,the back end and then implement it only when you  know everything is working properly come on spooky  ,another one's gone but wait one second there's  a bonus coming in this video that i'm sure you  ,weren't ready for and that is how to actually  set up your facebook columns i always see people  ,posting photos or sending me messages and their  columns are an absolute nightmare to look at  ,so i'm going to bless you all with this  because this is actually something that  ,will help you so much i'm going to quickly go  over your facebook column setup and exactly  ,why it's set up this way so you can properly  manage all the data points this is an absolute  ,golden nugget so make sure you watch this section  of the video because this is such good free value  ,so when it comes to the facebook column setup this  is my main column setup as you can see we have  ,all these different data points coming through  here and the reason why it's set up this way is  ,because then we can go ahead and we can track the  data and we can track the cycle of the customer  ,through our sales funnel so this is literally the  cycle of the customer through our sales funnel i'm  ,gonna quickly go into here and i'm gonna show  you exactly what these columns are so what i'm  ,gonna get you to do if you're watching this and  you're actually taking your business seriously  ,take a screenshot of this right here and go ahead  and implement this on your facebook account and  ,then i'm going to quickly explain exactly how to  track the data from these different data points  ,so this is the first section we have all these  different data points right here as you can see  ,certain ones are unique make sure you're using  the unique do it exactly like how i have it  ,set up here this is gonna benefit you in so many  different ways then once you've got all that and  ,hopefully you've taken a screenshot we'll scroll  down a little bit more where we were at the add  ,to carts and the initiate checkouts which were  right there this is the next section again take  ,another screenshot we're gonna implement this and  it's gonna boost your business i promise you this  ,now that you've got a screenshot of that this is  the final little section right here we're going  ,to take a screenshot of that and go ahead  and implement it so now i'll go ahead and  ,i'll quickly explain why my columns are set  up this way and why it gives me the ability  ,to properly track properly track all of the data  and see exactly how well my campaigns and my ad  ,sets are actually performing this is what we want  to do we have the cycle of the customers so first  ,we have the impressions the budget is there just  so that we know how much we're spending but the  ,impressions is going to show us exactly how many  impressions so how often our ads are being seen  ,stage one of the funnel the next stage is our cpm  because that's going to show us just how well our  ,ad is actually performing a lower cpm typically  means that your ad is performing better in the  ,facebook algorithm which means you're getting  more impressions then after that we have 95  ,video views this is here because we want to  see exactly how many customers are not only  ,seeing so impressions but are actually watching  through the video so actually engaging with our  ,ad or our content because someone that just sees  it for one second and leaves that's an impression  ,but that's not someone that actually engaged with  our ad so we have the 95 video views right there  ,then after someone's shown interest in our  ad after seeing the ad we want to see exactly  ,where they went after that did they actually click  through this is why we have unique click-through  ,rate all and then we also have unique link  click-through rate so the reason why we have these  ,two is because click-through rate can mean someone  went ahead and clicked anywhere on your ad that's  ,a click technically but link click-through rate  means someone actually clicked on the shop now  ,learn more whatever you labeled your button as so  we want to see this because you're going to notice  ,there actually is a discrepancy there's a little  bit of a difference in the amount of people that  ,actually just clicked on the ad and the amount  of people that actually clicked on the link so  ,this is valuable data because it shows you exactly  what's going on with your ad and exactly how your  ,customers are actually engaging with your ad then  after that we have the total number of unique link  ,clicks so this is the unique amount of people  that actually clicked the link to take them to  ,the product page next section of the funnel baby  after that we then go to unique landing page view  ,because when it comes to link click that doesn't  mean the person actually let your entire product  ,page load that's a very key thing they may have  just clicked the link to take them to the product  ,page and then when it was loading too long they  decided to click away and said i don't even want  ,to see that product anymore so that's why we have  here unique landing page view and as you'll see  ,there is again a discrepancy in the numbers here  so we have more people clicking and less people  ,actually landing on the page so that's why this  one's a much more accurate data point for seeing  ,who actually clicked through landed on our product  page made it to the next section of the funnel  ,so that's why that's so crucial going on to the  next section of the funnel we have add to cart  ,of course because that's going from the page view  to the add to cart then we have initiate checkout  ,and finally purchases as you can see right here so  that's the entire cycle of the funnel and seeing  ,exactly how the customer transitions step by step  through the entire funnel then after that we have  ,cost per landing page you because we want to see  the cost of that section add to cart and purchase  ,we want to see the costs of all these different  sections of the funnel so that we can analyze  ,the data and see exactly how much it's costing  to get a person to that section of the funnel  ,i hope this is all making sense then when we come  in here we want to see the total amount spent  ,because that will give us a good understanding  of how much we've invested into that campaign  ,purchase conversion because that's going to show  us how much we're getting back from that campaign  ,and then of course purchase return on ad spend  because that's going to show us the data ratio  ,of amount spent to purchase conversion value  so the entire sales funnel how everyone goes  ,through it and the exact breakdown of the cost  of each section of the funnel to give you an  ,accurate understanding of what's going on with  your,facebook ads now if you're getting really  ,analytical here i'm sure you're wondering how  to deal with the uk vat and brexit laws so if  ,you click this video right here it's going to  actually show you exactly how you can go about  ,set up your v8 get ready for brexit and  make sure that your store is all good to go  ,with the uk value added taxes thanks so  much for watching this video if you did  ,like it make sure you give it a thumbs up and  subscribe to the creed for all future videos

Congratulation! You bave finally finished reading how to add purchase event code to shopify and believe you bave enougb understending how to add purchase event code to shopify

Come on and read the rest of the article!

Browse More Content