by Dave | facebook
SamCart-Facebook Conversions API.
In this video, we’re gonna cover how you can integrate the Facebook conversion API with your SamCart account. Now, I would consider this a backup to the Facebook pixel if it doesn’t fire during a purchase event. And that does happen, it’s recommended to use this if you’re making multiple sales per day using Facebook ad. And I’ve observed about 10% of sales not reported by the Facebook and important you need a Facebook Business Manager account with admin access or you won’t be able to implement.
So let’s dive right in. To start with want to give you an idea of what the integration script looks like. This is simply reporting the number of transactions on a daily basis, it’s just effectively eye candy. There are two pages, I think that are worth looking into. If you’ve never set up a Facebook pixel don’t understand the business manager, I’d recommend visiting this page and going through step by step how to get the setup. Second, this page here, once you purchase the script and login, you’ll be able to download it. Regardless, you’ll be able to see this information in here based that’ll show you the requirements, how to install what to do with Facebook, the Integratepro script, your shopping cart setup and then going live.
So to start with, let’s just make sure we understand the requirements. First off, you’ve got to have web hosting allows you to upload files or scripts and then also create a MySQL database. No, this is not a WordPress plugin. And it probably won’t work on WordPress only type posting. As I mentioned you Facebook Business Manager account, access to the Facebook pixel, the ability to create an access token which means you have admin access. And then you need a shopping cart, Samcart or Thrivecart. So to install, we’re going to follow an install script. And what I’ve done is I’ve already downloaded the zip file, and I’ve uploaded it to my server, extracted it put it in the right directory, I’ve created the database I need now I just need to run the installation. Step one just checks to make sure your server is up to date. If it’s not, you probably want to let your web host provider know and ask them to upgrade. Click on Continue.
This is basically telling you, you need to know your database information. And finally, you want to enter your database name, username, password and host. And if installation goes successfully, you’ll be prompted for your name, email and a password so you can log in and click on Submit.. And now go ahead and login.
So this screen will populate with events as they occur. But in the meantime, we need to do some one time setup. Click on an account we need to add a Facebook account you can give it whatever name you want, you need to find your Facebook pixel ID. So you want to go to business.facebook.com/events_manager . Find the pixel and then copy that, back here we want to paste this in, go to the access code. So now back to Facebook, go to Settings Scroll down till you find it conversions API and create click on Create access token. Now again, you need to have admin access to this account. Otherwise, you won’t be able to do this click on Next select the pixel, click on Generate access token, click on the code it’s copied. Click on next and done. Back to the integration script here paste in what you just copied, click on Add Facebook account. Now create a Sam card account. This is even easier, just give it a name doesn’t matter what it is. Click on Add SamCart account. Let’s go into automation.
And let’s hook up our shopping cart to our Facebook account. Since we only want to have one it’s pretty obvious what we’re doing. And then unfortunately, with SamCart, they don’t pass back the information about the currency so we have to select. To set the currency for SamCart, click on Add. Now whenever an event comes from SamCart, this Sam card account, it’ll be sent over to this Facebook account using this currency. Now we want to go into SamCart. Now from inside your SamCart account, you’re gonna want to click on the gear icon up here, which is settings, make sure you’re in general, and then scroll down until you get to the section that says embed HTML scripts in header. We’re going to update some code here shortly. Most importantly, you want to make sure this is on file, pick fire pixels before redirect. If you don’t, and you’re the custom thank you page, your pixel purchase is not going to show up. So what we need to do now is we need to embed the Facebook code in here. Alternatively, you could put it in Google Tag Manager.
So what you want to do is find the base code for Facebook, which looks like this, you’re going to copy all this and then make a replacement where it says this and this you’re going to put in your paid Facebook pixel ID. So now what I’m going to do is inside the embed HTML scripts and header, I’m going to go ahead and paste in that Facebook code. I’m going to click on save and then go to integrations. Now we need to set up an integration a new integration. This is going to be a notify URL. Click on Next step, give it a name, whatever you want, and then a notify URL. So you need to get that from here. Copy this back to SamCart, paste in the notify URL. Click on Save integration. Last thing global rules, click on new rule, select a trigger, it’s going to be order completed. Next step, select integration. It’s in this case Dave’s pixel, select an action, send notify URL post next step, and submit. That’s it.
Now, what we need to do is on a product by product basis, adding some code that will push information to Facebook. So we’ve taken care of the global information. Now we need to go to a specific product. From the Advanced Settings tab, you want to scroll down to the fire pixels after an order is completed paste in this code, which you can find in the membership area. And this is sending over purchase information, we’re using an event ID that’s based on the order ID since its unique, passing over the value of the transaction, the currency which you have to hard code in there, and the optional product name and product ID and then click on save changes. And then I’m in test mode. So I’m going to actually do a purchase to verify that this is working properly. Now before we do that, I’m going to go look in my Facebook account. And I want to go to overview and right now and this pixel, I’ve only had a few events total. And it’s all been browser based. If this is working properly, we’re going to see a purchase event and we’re going to see both browser and server show up. So I’m going to go ahead and fill this out.
Place Order Don’t worry too much about this little warning message because SamCart embeds the Facebook pixel twice, once in JSON encoded format. And once the way it should, the most important thing is that it sent over this purchase $1 USD, product name is “test”, product ID and event ID. Now if we go into Facebook, unfortunately, this may take a few minutes. So nothing yet. So I’m going to simply pause the video and come back a few minutes. Okay, it’s been about 20 minutes, we finally have some purchase event. So it’s only showing the server for whatever reason the browser pixel doesn’t seem to be sent over. And what we’ve got here is actually there’s a couple purchases that went through while I was doing this. But it’ll basically show you as much information as sent over, they tend to hide this. So this is a different product that was purchased. So there’s mine currency, USD $1. They removed the name and the product ID. I think I’m gonna wait a little bit longer to see if the browser event shows up. But regardless, the server did send over the appropriate information about the purchase.
So it’s been almost an hour and we still haven’t received the pixel data from the browser with regards to the purchase but we did receive the server information.
So that’s the reason you want to implement the SamCart Facebook conversions API.