lp_key to the visitor’s URL, and your landing checks that key before showing the page.
Use it for a 302 Redirect Mode campaign when you control the landing’s hosting. You need a server that runs PHP. A JavaScript check in the browser cannot protect HTML that has already been sent to the visitor.
How it works
- The visitor opens your campaign Tracking link.
- Metricanic replaces
{lp_key}in the landing URL with a generated key. - Your PHP page validates the key. A valid request opens the landing. A missing, changed, or expired key returns
404.
1. Prepare the PHP file
Createmetricanic-guard.php beside your landing’s index.php. Copy the code below into it. Open Profile → Security → LP protection key, click Copy, and replace PASTE_YOUR_LP_PROTECTION_KEY in that PHP file with the copied secret.
Keep the secret in PHP on your server. The public landing URL gets a generated key, never the secret from your profile.
Copy the PHP protection file
Copy the PHP protection file
2. Add one line before the page HTML
Put this at the very beginning ofindex.php, before any HTML, spaces, or other output:
index.html, serve it as index.php on PHP hosting and update the landing URL if necessary. Remove the old public HTML copy after verifying the PHP page, otherwise it remains an unprotected way to open the same content.
If you use a CMS or page builder, its server must run this check before rendering the protected page. Pasting PHP into a browser-side HTML widget is not enough.
3. Add the key to the landing URL
Edit the landing in Metricanic and set its URL to:&lp_key={lp_key} if the URL already has a query string. Select the landing in your campaign’s rotator, save, and enter through Tracking link.
Disable shared HTML caching for this protected page and clear existing cached copies. Every request must reach the PHP check, including requests rejected earlier. Keep the original visitor User-Agent when a proxy forwards the request.
Check that it works
If every request fails, check the copied secret, PHP execution, server time, and User-Agent forwarding. If the bare page still opens, check for an old HTML copy or a cached response.
Do not enable this gate on the first page of Direct Script Mode. That page must open before its tracking script can register the visit. The account’s protection secret is shared by its campaigns, so this check also does not restrict access to one particular campaign.