This is an advanced guide, if you are new to affiliate marketing / internet marketing – this is not for you and will be very confusing. This guide is also for Facebook Ads and covers advanced technique used in order to help build custom audiences, and better targeting techniques for paid advertising campaigns on Facebook.
Let’s say you are running a campaign, diet, skin, lead gen, app installs, pin submits, eCommerce, whatever; and you want to optimize for people who came to your landing page, and then clicked the link to fill out the offer.
Wouldn’t it be great if you could optimize based on everyone who actually clicked (thus is more likely to convert) vs everyone who visited the page, many of whom then bounced from there?
There’s a way, and it’s done by using a little javascript and assigning custom functionalities to your links/buttons.
Step #1 – Grab the Facebook Pixel Code from the Ad Manager front end. If you don’t know how to do that, read this guide from FB.
Here’s my ORIGINAL code I got from Facebook:
Step #2 – We need to add a custom javascript function that will “FIRE” the facebook conversion pixel. Here’s the code we must add to the default Facebook pixel:
After we are done, we must paste the modified Facebook Conversion Pixel code between our <head> </head> section on our website; it should look like this:
NOTE: You must replace the 1150734851629733 with your own pixel ID!
Step #3 – Next, we need to add some code snippets to all of our links in our landing page/and or buttons as follows
For text links:
For a button:
For a link styled to look like a button:
Now when you setup your Facebook Ad Campaign, make sure to select Optimize for ADD TO CART; because everytime someone clicks a link on your landing page; it will fire the pixel and you want clickers, not people who just come to the lander, then leave right away.
21 thoughts on “How to Fire The Facebook Pixel When Someone Clicks A Button or a Link On Your Lander”
Thanks for the tutorial Attila, very useful.
Now would you have an idea how to fire the Facebook pixel from a tracker like Adsbridge after a conversion occurs ?
Nice idea. Will test it soon. Thanks!
It means you have never heard and test about that from many months ago? FB Introduce pixel in dec 2015, it’s already completed one year ago. I am unsubscribing you now, by d way all the time you just promote your FPtraffic.
I’ve been using the pixel for a long time in my Facebook marketing. His implementation of the onClick calling it is what I thought was a nice idea.
I’ve done a few emails about FPTraffic over the past month because I’ve done a ton of updates to it. I’m also reaching millions of people a day on Facebook for free now because of it, which is a pretty good reason to talk about it in a marketing newsletter.
It’s cool though, I’m not upset about losing a subscriber over complementing Attila on his cleverness. That’s why I read his blog lol
Lol, then how you used pixel in your bla bla bla marketing? What kind of data you’re tracking when pixel is fired? We all know in most of CPA lander we use links and button, so here Atalia use Add to cart tracking in links, that’s it.
I comment here, because you said nice idea, which is really simple if you ever used pixel in marketing. How you can said it is nice, if you’re using pixel from a long time. If you ever use pixel for 6 months, then you will know that these things. Please don’t be act like you have used fb pixel from a long time. Anybody can clearly see that that, you have never used by reading your comment.
It’s not few emails by d way, you’re sending that from 2 months. And I see some of your viral post, and I see you’re not monetizing it, because you know it, it is hard to monetize such non-target traffic, or such promotion can unpublish your page anytime. By d way we all know if such thing is work like charm then nobody will tell you the truth or share something to increase competition. I just want to say, guys don’t wast your time on FPtraffic, instead create niche blog and Do SEO if you just want free and targeted traffic, you will get better and quick result, than FPtraffic.
name is attila, not atalia.. say it with me -AHHHHHHH-TEEEEEEEEE-LAAAHHHHHHHHHHHH
You’re making a lot of assumptions and you’re wrong about a lot of things, but I’m just going to leave this alone. It isn’t worth my time to argue or explain. Good luck with your marketing and endeavors.
Yeah good to luck to your network(PeerFly) as well. The network who kept so much commission. No one top affliate guy(Charles Ngo, Attila, Malan Darras) mention you, this is why you’re commenting on those blogs. Rarely few people meet your team in any affliate event that you have attend :p
Ah…yeah, I was wondering how this can be done effectively.
so…I am using VOLUUM and there I am using the “multi offer click url” I think it should work by simply adding it to it…
What I would like to setup soon is to actually build a lookalike audience based on converted traffic data…
🙂 szia Attila…tetszik hogy mit csinalsz…! fasza…majd egyszer együnk es igyunk budapesten valamit…”disnotörös” vagy valamit…hahaha…!
Is there a way to implement this with Google Tag manager? (To mask the location the pixel the fired from).
Isn’t this risky when running diet/skin or another BH offer? Because that JS is going to report your lander URL..
What about an alternative where there’s an intermediary between the lander and the offer that just fires the JS AddToCart event before redirecting to the offer?
this is what i need.
You can make a rapid-switch reidrect page that has the FB conversion after the tag. If it auto-redirects, for instance, to Amazon quickly, your customer won’t notice, and you won’t have to worry about Atilla. The only issue is that you can’t be sure the customer actually buys the product when they get to Amazon.
Personally, I think Amazon should get with the program and allow merchants to insert the FB conversion code into their listing. It would be YUGE!
A couple questions on this. I put in the function in my main pixel and added the code to the links. When I save the page, the code disappears. Is this normal? It’s a WordPress site if that matters.
Is there a way to create a custom audience from this addtocart event and landing on that specific lander? Facebook seems to allow event AND page not AND.
Can’t people sabotage your pixel by putting it on spam sites if they have your ID in the photos?
Great Article!
But what would the code snippet be like for an image that links somewhere?
I tried some things myself but It doesn’t work. Would be awesome if somebody could help me.
I have many Agency Google adwords accounts for rent. This account helps you promote your business with Google ads or drive traffic efficiently. Can spend over $5k a day.
Good for traffic, affiliate, news, skin care, nutra…
Please contact me on skype: hiepdigital when you need
Agency Adwords account for whom interested
Hi Attila, have you ever tried to add google tag manager with FB pixel into advertiser’s page via hasoffers/cake? Should probably work as well, right?
hey. where inside my code do i add the snippet for a button?
thank you!
Awesome but how do you track conversions with Cake and FB pixel setting up a custom conversion? It’s all good tracking which FB users click through the pre-lander to the offer but I would also like to know which users actually convert. I know where to put my FB pixel in at the testing and tracking part of the offer on cake but then how do I set up a custom audience on FB to track those conversions?
Hello –
Thanks for this, I have been trying to figure this out all day.
However, when I click my link (set up as you suggested), I get this error (using Pixel Helper Chrome plugin)
! Lead
ERRORS
The Facebook pixel code on this page didn’t load, so no information was sent to Facebook.
Any ideas?