Landing Pages

About Landing Pages

Landing pages (aka Prelandings) are the pages the visitors see before offers. Sometimes these landing pages can be the target pages and can even send leads to a tracker. Keitaro allows to use your own page with an HTML file and an external service.

Creating a Landing Page


The name of your landing page.


The name of the group the landing page belongs to (if any).

The way of showing a landing page

  • “Local” (recommended) — allows to upload your landing page archive, which will be automatically unpacked to a tracker’s root directory and this landing page will work without redirects. Pack a zip archive for a correct work.
  • “Redirect” — the visit to a landing page is made via a redirect.
  • “Preload” — a landing page is downloaded and is shown right on the campaigns URL. Redirect is not used. You can use macros in a landing page code.
  • “Action” — the visitor is sent to a landing page with a redirect performing a definite action.

Landing Page Address (URL)

A full path to your landing page, e.g. You can add parameters and macros to the address.

Landing Page Types

Local Landing Page

This type landing page is opened without any redirects and is opened faster than a preloaded landing.

You need an archive with all landing page files. There should obligatory be an index.html file. This file will be opened while launching a landing page. The file can be index.php if there's a PHP feature for landing pages enabled in settings.

A landing page can contain additional pages, but macros won’t work on them. All the parameters should be transferred manually:

<a href="page2.php?_offer={offer}&_subid={subid}">Page 2</a>

The content of parameters is also transfered manually:

<a href="<?php echo urlencode($_GET['_offer'])?>">Offer</a>
  <input type="hidden" name="subid" value="<?php echo urlencode($_GET['_subid'])?>">

If the PHP is enabled, global objects $rawClick and $stream can be used inside index.php:

echo $rawClick->getKeyword();


Lading pages of these type can be located on any server. Keitaro uploads this landing page and show its content to a visitor. If a landing page has any links to other pages, they will be opened with an original address.


If this kind of a landing page works, a user will be sent to its URL with a redirect. _subid and _token parameters will be automatically added to its address. These parameters are necessary for correct postbacks’ and offer links’ work.

Landing Page - Action

If there's such a kind of a landing page in a stream, a definite action will be executed. E.g. if we choose «Show HTML», a visitor will see an HTML page.

Enabling an offer on a landing page

It’s necessary to add a special piece of a code to every website link so that offer visits work. A stream with necessary offers should be enbled for an offer link to perform well. Below is a description of how to enable offers depending on a landing page type.

Enabling offers on a local landing page with a preload

To create a link to an offer use a macros {offer}. An example of a button:

<a class="btn btn-success" href="{offer}">Link</a>

Enabling more than one offer on a local landing page with a preload

If you have some offers you can define which offer to open:

<a class="btn btn-success" href="{offer:1}">Link</a>
<a class="btn btn-success" href="{offer:2}">Link</a>

1 и 2 — offers ID examples.

Enabling an offer on a landing page with a redirect

If you use a redirect, two obligatory parameters _token and _subid are added to a landing page address. To create a necessary offer link use a ready code from the right part of the screen, which you see while creating and editing a landing page.

Enabling more than one offer on a landing page with a redirect

You need to add offer_id parameter to links. Example:

<a href="<?php echo urlencode($_GET['_token'])?>&offer_id=1">Offer link 1</a>
<a href="<?php echo urlencode($_GET['_token'])?>&offer_id=2">Offer link 2</a>

Enabling an offer in Actions

{offer} macros can be used in Actions. E.g., if you use «Show HTML» action, you can insert an offer link inside the code.

Using an order form on a landing page

If you send leads through a script, you need to send a click’s subid together with leads. Subid with {subid} macros can be added in local landing pages with a preload:

<input type="hidden" name="subid" value="{subid}" />

After, get the info in a parameter $_POST['subid'] (in case the form is transferred through the POST method).

Enabling an external website with Click Client (PHP)

This solution allows to get a traffic directly on a website and transfer data via Click API to Keitaro.

An example of enabling a website with a ready-made library Click API Client:

  1. create a campaign;
  2. create a landing page with your website address;
  3. create a stream with «Landings and Offers» schema. Choose a landing page(website) and offers;
  4. go to «Integration» page (Additionally > Integration);
  5. Choose “Click API Client v2”;
  6. add a code to your landing page following the manual.

Adding offers to a website which works Click Client

  1. Delete $client->execute() line in a code. It calls an immediate redirect to an offer;
  2. this kind of a code will give you a link to an offer:

<a href="<?php echo $client->getOffer()?>">Offer Link</a>;

  1. check if a landing page works.

Enabling more than one offer on a website which works with a Click Client

The situation is the same as with using an offer. All we need is to add an offer_id parameter:

<a href="<?php echo $client->getOffer(array('offer_id' => 1))?>">Offer link 1</a>
<a href="<?php echo $client->getOffer(array('offer_id' => 2))?>">Offer link 2</a>

Enabling an external website with a tracking script

This solution is perfect for websites on a CMS. The code for installing a tracking script can be taken on a Campaign’s page in an Integration tab.

Read more about a tracking script on a Tracking script page.

Enabling an offer on a website which works with a tracking script

Put a link with an {offer} macros in a website code, e.g.:

<a href="{offer}">Offer link</a>

All campaign streams should be with offers in order for link to work.

Read more about a tracking script on a Tracking script page.

Adding more than one offer to a website with a tracking script

Offers IDs can be added inside the links:

<a href="{offer}&offer_id=1">Offer link 1</a>
<a href="{offer}&offer_id=2">Offer link 2</a>

Sending postbacks

The ways of sending postbacks depend on a type of a landing page being used.

Sending postbacks from a local landing page (form)

If there’s a form on a landing page, an additional input is needed:

<form action="send.php" method="post">
<input type="hidden" name="subid" value="{subid}" />

Now postbacks can be sent in a send.php script:

$url = 'http://POSTBACK_URL?payout=100&status=sale&subid=' . urlencode($_POST['subid']);

Sending postbacks from a local landing page (button)

If there’s just a button on a landing page subid is added the following way:

<a class="btn btn-success" href="thanks.php?subid={subid}">BUY</a>

Now postbacks can be sent in a thanks.php script:

$url = 'http://POSTBACK_URL?payout=100&status=sale&subid=' . urlencode($_GET['subid']);

Sending postbacks from a landing page after a redirect

Sending postbacks from a website with a Click Client

Sending postbacks from a website with a tracking script

Updating parameters of a click from a landing page

Parameters can be updated in some ways:

  1. in a postback, see page Receiving postbacks;
  2. in an offer link, e.g., {offer}&sub_id_1=123;
  3. through a special address update_tokens. See examples below.

Updating parameters of a click on JS

<script type="text/javascript">
function update_tokens(subId, param, value) {
  var img = document.createElement("img");
  img.src= kUrl + '?_update_tokens=1&sub_id=' + subId + '&'+ param + '=' + value + '&return=img';

Now you can all:

update_tokens('{subid}', 'sub_id_8', 'test')

An example of update_tokens with a tracking script

This solution works only on websites with tracking script:

KTracking.update({sub_id_8: 'test'})

An example of update_tokens on PHP

function updateParams($subId, $params) {
   $kUrl = 'TRACKER_URL'; 
   $url = $kUrl . '?_update_tokens=1&sub_id=' . urlencode($subId) . '&' . http_build_query($params);
   $result = file_get_contents($url);
   // echo $result;

Change TRACKER_URL to your tracker's address.

Now you can call updateParams('sub_id', [params]);. E.g.:

updateParams($_SESSION['sub_id], array('sub_id_1' => ''))

General questions about Landing Pages

How to make limits for uploaded archives with local landing pages files bigger

The size of an uploaded archive is limited within some PHP and nginx directories:

  1. upload_max_filesize in php.ini
  2. post_max_size in php.ini
  3. client_max_body_size in nginx.conf

How to send a lead from a landing page without a tracking script

You'll need to follow the next steps:

  1. send a subid to a landing page;
  2. get a subid on a landing page and save it to a session;
  3. send a postback when the order is completed.

Detailed description:

1. Add a subid transfering inside a stream, e.g.,{subid}.

2. Add saving subid into a session on a landing page (add this code on all pages, if there are some of them):

if (!empty($_GET['subid'])) {
  $_SESSION['subid'] = $_GET['subid'];

3. Add an affiliate network on an «Affiliate Networks» page. Fill in any name, e.g. Collecting Contacts. Use a basic postback.

4. After the order is completed, send a postback:

file_get_contents('' . $_SESSION['subid']. '&payour=1.23&status=sale');

Change to your basic postback. Read more about postbacks on a Postbacks page.

How to transfer all parameters through a landing page

All parameters are added to an offer URL if you use a “Landings and Offers” scheme. Below is the solution when you use a static link on a landing page.

Solution on PHP:

<a href="<?= http_build_query($_GET) ?>">Link</a>

Solution on JS:

<script>document.write('<a href="' +'?', '') + '">Link</a>'</script>

How to transfer parameters if there's an order form on a landing page

Add transferring parameters into the order form code, e.g. subid1 is transferred the following way:

<input type="hidden" name="sub1" value="<?php echo urlencode($_GET['sub1']);?>">

Ypu must add parameter &exit=1 to offer links. That will ignore these clicks from metrics LP Clicks, LP CTR, etc. Example with using {offer}:

<a href="{offer}&exit=1">Offer</a>

How to insert a subid and other info on a landing page with a redirect

The solution works only if traffic first goes to Keitaro and a landing page works with a “redirect” type. If you use “Preload” feature, read the following park of our documentation.

Edit the landing page settings. Ad necessary parameters and macros to Landing page URL:{device_model}&city={city:ru}&subid={subid}

Received parameters can now be inserted to a landing page:

     <script type="text/javascript">
       function getURLParameter(name) {
           return decodeURI(
               (RegExp(name + '=' + '(.+?)(&|$)').exec(||[,null])[1] || ''
  Cases for mobile phones <script>document.write(getURLParameter('model'))</script> 
  In a city of <script>document.write(getURLParameter('city'))</script>

Or on PHP:

  Cases for mobile phones <?php echo htmlentities($_GET['model'])?>
  In a city of <?php echo htmlentities($_GET['city'])?>

How to insert subid and other info to a landing page with Preload loading type

If you enable “Preload” loading type for a landing page, you can use all macros just in a landing page code, e.g. {subid} macros:

<script type="text/javascript"> 
var m1_product_id = 123; 
var ref = 123; 
var script = document.createElement("script"); 
script.src = ""+ref+"&s={subid}&w="+getC("w")+"&t="+getC("t")+"&p="+getC("p")+"&m="+getC("m")+"&product_id="+m1_product_id+'&out=1'; 

If you use «Landings and Offers» scheme in a stream, the link to an offer is created by a macros {offer}:

<a href="{offer}">CLICK</a>

Why are such metrics as LP clicks, LP CTR and Sale Time not calculated?

A click on an offer should be done through Keitaro in order to calculate all these metrics. As you need to add offers to Keitaro and set up landing pages and offers in a single stream, there should be installed a code for sending to an offer.

How to transfer parameters to a FB pixel

An example of transferring subid when the “Preload” feature is enabled on a landing page:

// Insert Your Facebook Pixel ID below. 
fbq('init', 'FB_PIXEL_ID');
fbq('track', 'view', {
   subid: '{subid}'   

How to protect a landing page from direct visits

1. Transfer parameter in a landing page URL, e.g., code=123 (

2. Add a code to a landing in the very beginning of a page:

<?php if (!isset($_GET['code']) && $_GET['code'] != '123') { die(); } ?>

Why are images not shown if I use «Show HTML»?

Keitaro shows a page not on the address you created your website. That's why a web browser can't find images. Change all images URLs to absolute:

How to get rid of direct landing page visits

Solution on PHP:

if (!isset($_GET['_subid'])) {


Is it necessary to put full paths to files in lical landing pages?

You can put relative paths, e.g.:

<img src="images/photo.png" />

Is it necessary to put any integration code to the local landing page?

No, it isn't. A local landing page works in campaigns.

Why are the clicks are doubled when the landing page is opened?

Usually, it happens when “Catch 404 errors” feature is enabled in domain settings. You can either disable this feature or look for the files which are called by your landing page but are missed in an archive.

This can be checked with the browser JavaScript console.

Why don't anchors work in local landing pages (#anchor)?

The used basepath can't work with anchors. The solution is to use class and id instead of anchors.

Can I get rid of <base path> in local landing pages?

No, you can't. This tag shows the paths to all styles and landing page images. Use “Show HTML” action and manually insert addresses of all styles and images if you need to eliminate external addresses.