Salaam alaikum, Yellow Web is online again. In the PM, you dear readers regularly ask: "How do I pour from different accounts to the same landing page? How do I use different pixels so they don't conflict?" And so on and so forth.
To to close this topic once and for allI've decided to elaborate on this question as much as possible. Let's look at all the possible options:
- using tracker Keitaro
- using free clo from yours truly
- without using anything, from scratch
To check the results, we need an extension for Google Chrome - Meta Pixel Helper, set it up, geez, and let's get to it!
Getting into the logic of action
First, let's go through our entire funnel and see how a pixel participates in it:
- In the link that we will shove into the Facebook ad, we need to add a certain parameter with the pixel ID as the value, so that it looks something like this:
https://mydomain.com?px=12345678
You can choose any parameter name you want, for this article I will use the namepx
. - However, I personally recommend putting this parameter not in the link itself, but in a special field in the ad - "URL Parameters".. In this way you will slightly protect yourself from Spy-services that cannot get the value of this field.
skrinshot-23-05-2023-140831.png605×605px469skrinshot-23-05-2023-141023 - After a user clicks on our link and gets to our site, we need somewhere save the pixel identifier (id) from the reference. This is usually done within the application form or in cookies. Let's look at both options.
If we save the pixel id in the form, then:
- When a user leaves a request, the pixel id is sent along with other form fields to the lead processing script. The lead is sent to the PP, and the "Thank you" page is shown. In the first case, the "Thank you" page is redirected, then a parameter with the pixel id is added to the redirect link. In the second case, "Thank you" is displayed directly at the address of the lead sending script.
- The "Thank you" page pulls the desired parameter and substitutes its value into the tag with a Facebook "short" pixel. The pixel sends a Facebook Lead event.
If we save the pixel id in a cookie, then:
- The user leaves a request, the Thank you page is shown (in any way)
- The "Thank you" page pulls the pixel's id from the cookie and substitutes its value into the Facebook "short" pixel tag. The pixel sends a Facebook Lead event.
WARNING: If you want to pass the pixel through a cookie, you MUST use the SAME DOMAIN for the "Thank you" page as the one in your link in the Facebook ad. Otherwise, you won't be able to get the saved pixel id from the cookie.
That's the whole funnel, now let's look at it in detail with examples.
Pixel dropdown using tracker Keitaro
Setting up tracker
First of all, we need to reserve any of the available tracker labels for our pixel. To do this, we go to Sources and create (or edit if you created it before) source from the Facebook template.
Scroll down to Parameters and see that Sub Id 6 already has a parameter for the pixel. Change its name in the middle column from pixel to px:
Now, when users come to us who have px=1234443234
, the pixel id will be stored in the 6th marker trackerand we will be able to use the name we set px
as a macro {px}
to get the pixel id value.
Customizing the banding
Landing in this case, I will call the site, which has an application form. In terms of Keitaro This is called an "Offer", but in fact, no matter where you put your site, in "Landings" or in "Offers", the principle of the pixel will be the same.
Let's look at 2 ways to drop a pixel, through a cookie and through a form.
Sneaking through cookies
We need to save our pixel in a cookie, which we will name exactly as the label was named, i.e. px
. I suggest to do it with Javascript, in general you can also use PHP, but it's easier. Open our landing page to edit the code and immediately after the tag <body>
insert the following code:
.document.addEventListener("DOMContentLoaded", function() {
const pxValue = '{px}';
if (!pxValue) return;
const date = new Date();
date.setTime(date.getTime() + (7 * 24 * 60 * 60 * 1000));
const expires = "expires=" + date.toUTCString();
document.cookie = 'px=' + pxValue + ';' + expires + ';path=/';
});
</script>
That's it, our pixel is saved (for this, if you have noticed, we used the macro Keitaro {px}), proceed to the setup step of the "Thank you" page.
Rolling through the form
First, we need to open the index.html or index.php code of our landing page in the built-in editor Keitaro. Next, look for all the tags form
who have a prescription for action
.
For each such form, we need to add a hidden field, in which we write the pixel id from the saved in the Keitaro px labels. To avoid confusion, we call the field the same as the label:<input type="hidden" name="px" value="{px}"/>
Here we use a macro {px}
Keitaroto get the pixel id value from the saved 6th marker, which is already saved there.
Now, when the user sends his data to the lead script, the pixel will go with it!
P.S. Be sure to check that the form has a send method method="POST"
.
Setting up a script for sending leads
This point applies ONLY if you have decided to send a pixel through a form. If you are using cookies, go straight to page setup Thank you.
First, we find our PHP file for sending leads: it is usually called order.php
You can see exactly how you named it in the previous step, when we edited the form: it is prescribed in the attribute action
of the tag form
. Open the file for editing in any text editor (preferably with code highlighting, like Notepad++).
Our task is to understand how traffic flows from the lead sending script to the Thank You page. There are two options:
- After sending the data to the PP, the script shows the Thank You page immediately, at its address - this is called "include".
- The lead file redirects the user to the Thank You page, and the address changes accordingly.
If you can't tell from the code how Thanks is connected in your case, just leave a test lead and look at the address bar in the browser. If you see the name of the lead sending file at the end of the line, then you have the include method, and if you see something like success.html, then you have a redirect.
Priver: this is what the lead sending file looks like from PP Shakes, where the include is used to show Thanks:
If we see that the connection is via include, then with the lead sending file you don't have to do anything, Go straight to the setup Thank you.
Example: this is what a lead file looks like from Lemonad, which uses a redirect to show Thank You:
Note: you can understand that a redirect is being used by searching through the code for the word Location:
When using redirects, we have to fiddle a bit: we have to add our pixel identifier to the redirect address. As always, we will use a parameter named px
.
We also need to determine if any other URL parameters are used when redirecting to Thank you. If yes, we add our pixel id to the end of these parameters with an ampersand (&). If there are no other parameters, then with a question mark. This is what it would look like for the above example:
//Option when there are other URL parameters
header('Location: '.$urlSuccess."&px=".$_POST['px']);
//Option when there are NO other URL parameters
header('Location: '.$urlSuccess."?px=".$_POST['px']);
After you have added a pixel to the redirect address, Follow this link to customize the Thank You page.
Customizing the Thank You page
Here we are looking at 3 variants: getting the pixel id from the cookie + 2 variants when we drop the pixel through the form and Thank you is connected either through include or through redirect.
From cookies.
So, the moment has come when we will show our pixel and send the event Lead. To do this, we use the following Javascript code, which we insert right after the tag <body>
at Thank You:
.
document.addEventListener("DOMContentLoaded", function() {
const cookieRegex = /px=([^;]+)/;
const pxCookieMatch = document.cookie.match(cookieRegex);
let pxValue = pxCookieMatch[1];
const imgElement = document.createElement("img");
imgElement.setAttribute("height", "1");
imgElement.setAttribute("width", "1");
imgElement.setAttribute("src", "https://www.facebook.com/tr?id=" + pxValue + "&ev=Lead&noscript=1");
document.body.appendChild(imgElement);
});
</script>
Congratulations! We threw a pixel, move on to To make sure that everything works correctly.
When you send a thank you from the lead sending script
All we need to do with this way of connecting Thanks is to write anywhere inside the tag <body>
page Thanks the following code:
<img height="1" width="1" src="https://www.facebook.com/tr?id=<?=$_POST['px']?>&ev=Lead&noscript=1"/>
Did you write it in? Proceed to check the correctness of the connection.
When redirecting from the lead sending script
The code is about the same as for leaving via cookies, but this time we get the pixel id value from the link. The code must be inserted in the Thank you page immediately after the tag <body>
.
.
document.addEventListener("DOMContentLoaded", function() {
const urlSearchParams = new URLSearchParams(window.location.search);
const pxValue = urlSearchParams.get('px');
const imgElement = document.createElement("img");
imgElement.setAttribute("height", "1");
imgElement.setAttribute("width", "1");
imgElement.setAttribute("src", "https://www.facebook.com/tr?id=" + pxValue + "&ev=Lead&noscript=1");
document.body.appendChild(imgElement);
});
</script>
Done, the pixel is thrown, proceed to the step of checking that everything works correctly!
A pixel through the free clo YellowCloaker
In the free clo You can set up pixel forwarding in just a couple of clicks. To do this, you need to write the name of the label where you will pass the pixel id (px by default) and select the desired event (Lead by default).
That said, if you want everything to work automatically, you should definitely use the custom "Thank You" page itself clo:
If you want to use the "Thank You" page that came with your landing page, you have two options:
- Tapping the conversion in FB when clicking on the "Order" button - to do this, set the appropriate setting
- Manually write the pixel code on your Thanks, while retrieving the pixel id from the px label, just as described here. In this case, the conversion will knock off in FB after switching to Thank You.
Don't forget. check that your settings are working correctly!
Pixel scanning without the use of extras
If you are not using tracker or mine. cloBut you want to throw a pixel, then almost all the part of the manual under the Keitaroexcept for the Landing Setup item. Everything else (I.e. setting up a script to send leads and Thanks) will occur in exactly the same way. Let's look at the differences.
Setting up a pixel piercing banding via cookies
Open the index.html or index.php of our landing page and insert it right after the tag <body>
the following code:
.
document.addEventListener("DOMContentLoaded", function() {
const urlSearchParams = new URLSearchParams(window.location.search);
const pxValue = urlSearchParams.get('px');
const date = new Date();
date.setTime(date.getTime() + (7 * 24 * 60 * 60 * 1000));
const expires = "expires=" + date.toUTCString();
document.cookie = 'px=' + pxValue + ';' + expires + ';path=/';
});
</script>
Next go to this point and follow the links.
Setting up a banding with pixel drop-through form
In this case, we need to do two things: add a hidden field to the form and use Javascript to give that field our pixel ID as a value:
Looking for all tags <form>
on the page and add inside each of them:
<input type="hidden" name="px" value=""/>
The only thing left to add right after the tag is <body>
the following piece of Javascript code:
.
document.addEventListener("DOMContentLoaded", function() {
var pxValue = new URLSearchParams(window.location.search).get("px");
var hiddenInputs = document.querySelectorAll("form input[name='px']");
for (var i = 0; i < hiddenInputs.length; i++) {
hiddenInputs[i].value = pxValue;
}
});
</script>
Next go to this point and follow the links.
Checking that everything works correctly
- Take the link to which your landing page is attached, add it to the end of the "tail":
?px=12342341234
and click on it. - Leaving a test lead on the landing.
- On the "Thank you" page, turn on the Meta Pixel Helper extension and check what it shows:
- The desired pixel identifier
- The pixel event we need (usually Lead or Purchase) - If your pixel event is displayed with a yellow "Warning" sign instead of a green checkmark, then turn off your ad blocker in Chrome and just reload the page, everything should be fine.
- If you do not see the desired pixel id - then you incorrectly performed a sweep, read the manual carefully!
Most importantly
Many PPs have already taken care of you and have automatic pixel scanning in your house when downloading the lendings!
As an example, here our Crazy Profits Partners service. We tried to make life as easy as possible for the average arbitrator and made a pixel drop through the tag for all of the offers fb
. It is enough to write https://вашдом.ен?fb=12342341214
And that's it! In case you're wondering, we did it through cookies.
And that's it for today, gentlemen, Yellow Web was with you, get on the plus side!
Hi! Everything worked through cookies, but what if I use preland, I guess I need to put some script in the code of preland too?
So if preland and land are on the same domain, all you have to do is write cookies on preland, and then take them out on Thank You. It's the same thing!
Deprecated: Creation of dynamic property Cloaker::$detect is deprecated in /home/f/floydgey/ledcheap1.site/public_html/core.php on line 68 Warning: Cannot modify header information - headers already sent by (output started at /home/f/floydgey/ledcheap1.site/public_html/core.php:68) in /home/f/floydgey/ledcheap1.site/public_html/main.php on line 105 Warning: ini_set(): Session ini settings cannot be changed after headers have already been sent in /home/f/floydgey/ledcheap1.site/public_html/cookies.php on line 22 Warning: session_start(): Session cannot be started after headers have already been sent in /home/f/floydgey/ledcheap1.site/public_html/cookies.php on line 23 Warning: Cannot modify header information - headers already sent by (output started at /home/f/floydgey/ledcheap1.site/public_html/core.php:68) in /home/f/floydgey/ledcheap1.site/public_html/cookies.php on line 4 Warning: Cannot modify header information - headers already sent by (output started at /home/f/floydgey/ledcheap1.site/public_html/core.php:68) in /home/f/floydgey/ledcheap1.site/public_html/cookies.php on line 4 Warning: Cannot modify header information - headers already sent by (output started at /home/f/floydgey/ledcheap1.site/public_html/core.php:68) in /home/f/floydgey/ledcheap1.site/public_html/cookies.php on line 4 Warning: Cannot modify header information - headers already sent by (output started at /home/f/floydgey/ledcheap1.site/public_html/core.php:68) in /home/f/floydgey/ledcheap1.site/public_html/cookies.php on line 4 Warning: session_start(): Session cannot be started after headers have already been sent in /home/f/floydgey/ledcheap1.site/public_html/cookies.php on line 9 Warning: session_start(): Session cannot be started after headers have already been sent in /home/f/floydgey/ledcheap1.site/public_html/cookies.php on line 9 Warning: session_start(): Session cannot be started after headers have already been sent in /home/f/floydgey/ledcheap1.site/public_html/cookies.php on line 9 Warning: session_start(): Session cannot be started after headers have already been sent in /home/f/floydgey/ledcheap1.site/public_html/cookies.php on line 9 Warning: session_start(): Session cannot be started after headers have already been sent in /home/f/floydgey/ledcheap1.site/public_html/cookies.php on line 9 Warning: session_start(): Session cannot be started after headers have already been sent in /home/f/floydgey/ledcheap1.site/public_html/cookies.php on line 9 Warning: session_start(): Session cannot be started after headers have already been sent in /home/f/floydgey/ledcheap1.site/public_html/cookies.php on line 9 Warning: session_start(): Session cannot be started after headers have already been sent in /home/f/floydgey/ledcheap1.site/public_html/cookies.php on line 9
Use PHP version 7.4, not 8
Добрый день, подскажите пожалуйста, в чем может быть причина?
у вас не отрабатывает код, который заменяет макрос {px} на id пикселя, либо такого кода вообще нет.
Событие Лид определяется, стоит зеленая галка, но сам id пикселя не определяется и отображается вот так
Meta Pixel
Troubleshoot Pixel
Set up events
Pixel ID: {px} click to copy