When working with Facebook Ads, it’s important to know which ad campaign, ad set or creative brought the lead. If data is passed incorrectly, some conversions never reach the ad account, and the algorithms get less information for optimization.
When working with nutra offers at Shakes.pro, this problem can be solved by dynamically passing the pixel ID through the URL. This approach lets you use the same funnel across several ad campaigns without manually replacing code on every page.
In this article we’ll break down how to pass the pixel ID from the prelander to the post-order page and correctly send the Lead event to Facebook.
Why you need a dynamic pixel
With a standard setup, the pixel ID is hardcoded into the page. If one landing page is used in several ad campaigns, you have to create separate copies of the files or change the code manually every time.
Dynamic passing works differently: the pixel ID is passed in the URL as a parameter and automatically travels through the entire funnel.
For example:
?pixel=123456789
This method is especially convenient if you:
- use one landing page for several campaigns;
- work with different ad accounts;
- run traffic to several GEOs;
- want to switch pixels quickly without editing files.
What to check before setting up
All pages that use PHP code must have the .php extension.
If a landing page or prelander is saved as .html, the PHP code won’t run. Rename the necessary files before you start.
For example:
index.html → index.php
success.html → success.php
Also make sure the server supports PHP.
Step 1. Pass the pixel ID from the prelander
If the user first lands on a prelander, the pixel parameter needs to be passed into the link leading to the main landing page.
In the index.php file, find the outbound link and add to it:
?pixel=<?php echo $_GET['pixel']; ?>
Example:
<a href="land/index.php?pixel=<?php echo $_GET['pixel']; ?>">Buy</a>
After that, the pixel value will automatically carry over to the next page.
Step 2. Pass the parameter into the order form
On the landing page you need to save the received value and send it together with the lead.
At the beginning of the file you can read the parameter:
<?php $pixel = $_GET['pixel'] ?? ''; ?>
Then add a hidden field to the order form:
<input type="hidden" name="pixel" value="<?php echo htmlspecialchars($pixel); ?>">
Now the pixel ID will be passed along with the rest of the form data.
Step 3. Pass the parameter to the post-order page
After the lead is processed, the pixel value must reach the success.php page.
If the data is sent via the POST method, read the parameter like this:
$pixel = $_POST['pixel'] ?? '';
Then pass it during the redirect:
header('Location: success.php?pixel=' . urlencode($pixel));
exit;
As a result, the user will land on a page with an address like this:
https://your-domain.com/success.php?pixel=123456789
Step 4. Fire the Lead event
Open the success.php file and read the pixel value:
<?php $pixel = $_GET['pixel'] ?? ''; ?>
Then place the event code inside the page:
<img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=<?php echo htmlspecialchars($pixel); ?>&ev=Lead&noscript=1"/>
After the order is placed, Facebook will automatically receive the Lead event with the correct pixel ID.
If the link already has other parameters
If the URL already carries UTM tags or other parameters, pixel is simply appended with the & symbol.
For example:
https://your-domain.com/flow?utm_campaign=test&utm_content=video&pixel=123456789
The main rule — the pixel parameter must be preserved at every stage of the funnel. If one of the pages fails to pass it on, Facebook won’t receive the correct event.
How to check the setup
Before launching ads, walk the entire path yourself.
Check:
- does the link with the pixel parameter open;
- is the value passed between pages;
- does the lead appear in Shakes.pro;
- does success.php open correctly;
- does the Lead event show up in Facebook.
It’s better to spend a few minutes checking than to hunt for a bug after the ads are already live.
Common mistakes
Files saved as .html. The PHP code doesn’t run, so the parameter isn’t passed.
Pixel is passed only on the first page. The value reaches the landing page but is lost after the form is submitted.
Different passing methods are used. The form sends data via POST, while the handler tries to read it via GET.
The URL is built incorrectly. The first parameter always starts with ?, the rest are added with &.
Conclusion
Dynamically passing the pixel lets you use one funnel across several ad campaigns at once and removes the need to manually change code on every launch.
If you work with Facebook Ads and run nutra offers through Shakes.pro, this setup will help you track conversions more accurately and analyze results faster.
Before launching, be sure to send a test lead and make sure the Lead event shows up correctly in the ad account and that the lead appears in your Shakes.pro dashboard.
You may also like
CASES $40,000 profit on Cardione IT: an Italy funnel breakdown from test to scale
Euphoria Traffic Team case study: how to make ~$40,000 net profit in a month on the Cardione offer in Italy — setup, creatives, pre-lander split tests and funnel economics.
GUIDES Domain parking in Shakes.pro in 5 steps: no DNS dance
How to park your domain in Shakes.pro: a CNAME record to parked.shakes.pro, adding it in the Parking section and connecting it to your campaigns — a one-time setup that takes a few minutes.
GUIDES Shakes Pro + Keitaro: 15-minute integration and lead submission via API
How to connect Shakes Pro to Keitaro with a ready-made template and submit leads from a local landing page via API: postback, order.php, subid and a test lead before launch.
