# General information

# About Landing Pages

Landing pages (prelandings, landers) 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 (local landing pages) and an external service(landing pages with redirects).

# Creating a Landing Page

# Name

The name of your landing page.

# 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.

# Group

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

# Landing Page Address (URL)

A full path to your landing page, e.g. http://site.com/page1.html. 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 Keitaro settings.

Landing page requirements:

  • The paths in attributes src and href should be relevant. NOT CORRECT: <img src="/home.png" />. CORRECT: <img src="home.png" />.
  • There should not be any internal js-redirect, e.g. window.location = 'index.html'. (NOT CORRECT)
  • There should not be any internal js-scripts with anchors, e.g. smooth scroll won't work <a class="slow-scroll" href="#form2">order.

Additional requirements for landing pages on PHP:

  • There should not be any of the following functions header(), exec(), system(), ob_start(), eval() in the landing page code.
  • The loading of additional scripts in include() and require() should be on obsolete paths, e.g. require_once dirname(__FILE__) . ‘/lib.php’;.
  • Landing execution time is limited with "Execution timeout for local landing pages and local offers". It can be found in 'Maintenance -> Settings -> Main' menu. Maximum value is limited to 9 seconds.

Remove 'base href' tags if there are any before uploading the landing page to Keitaro. Using your own base href will break your landing page, even if your code is commented out.

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();

# Preload

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.

# Redirect

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 and 2 — offers ID examples.

# Enabling an offer on a two pages local landing page

Suppose we have two pages - an index.html page and the page with an offer page2.php.

Update the links on an index.html page which lead to a page2.php, add the _token transfer tho that link:

<a href="page2.php?_token={token}">Link to Page2</a>

The link to an offer on a page2.php page should be added the following way:

<a href="//<?php echo $_SERVER['HTTP_HOST'] . '/?_lp=true&_token=' . urlencode($_GET['_token']) ?>">Offer</a>

For a multi offer landing page:

<a href="//<?php echo $_SERVER['HTTP_HOST'] . '/?_lp=true&_token=' . urlencode($_GET['_token']) ?>&offer_id=1">Offer 1</a>
<a href="//<?php echo $_SERVER['HTTP_HOST'] . '/?_lp=true&_token=' . urlencode($_GET['_token']) ?>&offer_id=2">Offer 2</a>
<a href="//<?php echo $_SERVER['HTTP_HOST'] . '/?_lp=true&_token=' . urlencode($_GET['_token']) ?>&offer_id=3">Offer 3</a>

# 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="http://tracker.com/?_lp=true&_token=<?php echo urlencode($_GET['_token'])?>&offer_id=1">Offer link 1</a>
<a href="http://tracker.com/?_lp=true&_token=<?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).

# How to set up the form on a two pages local landing page

Assume we have two pages: an index page index.html (or index.php) and an order form page order.php.

Change the links on an index page adding: ?_subid={subid}: <a href="order.php?_subid={subid}">BUY</a>

In order.php form add to the very beginning:

if (isset($_GET['_subid'])) {
    $_SESSION['_subid'] = $_GET['_subid'];

This code will accept _subid parameter and save it to the session. Now you can substitute this parameter from the session to the code to send data from the form, e.g.:

$params = array(
    'name'          => $post['name'],
    'phone'         => $post['phone'],
    'country'       => $post['country'],
    'sub1'            => $_SESSION['_subid'],        //       ←

# Enabling an external website with KClient PHP

This solution allows to get a traffic directly on a website and transfer data with KClient PHP to Keitaro.

An example of enabling a website with a ready-made library KClient PHP:

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

# Adding offers to a website which works with KClient PHP

  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>;

  3. check if a landing page works.

# Enabling more than one offer on a website which works with KClient PHP

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 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 tracking script.

# 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

See Sending a postback from a website to Keitaro page.

# Sending postbacks from a website with KClient PHP

See Sending a postback from a website with KClient PHP.

# Sending postbacks from a website with tracking script

See sending conversions page.

# Updating parameters of a click from a landing page

Parameters can be updated in some ways:

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

Only sub_id_1...15 parameters can be updated.

# 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')

Only sub_id_1...15 parameters can be updated.

# 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' => 'info@gmail.com'))

Only sub_id_1...15 parameters can be updated.