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
Name
The name of your landing page.
Group
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. 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 settings.
Landing page requirements:
- The paths in attributes
src
andhref
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()
andrequire()
should be on obsolete paths, e.g.require_once dirname(__FILE__) . ‘/lib.php’;
.
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>
<form> <input type="hidden" name="subid" value="<?php echo urlencode($_GET['_subid'])?>"> </form>
If the PHP is enabled, global objects $rawClick and $stream can be used inside index.php:
<?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
и 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="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).
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:
- create a campaign;
- create a landing page with your website address;
- create a stream with «Landings and Offers» schema. Choose a landing page(website) and offers;
- go to «Integration» page (Additionally > Integration);
- Choose «Click API Client v2»;
- add a code to your landing page following the manual.
Adding offers to a website which works Click Client
- Delete
$client->execute()
line in a code. It calls an immediate redirect to an offer; - this kind of a code will give you a link to an offer:
<a href="<?php echo $client->getOffer()?>">Offer Link</a>
;
- 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}" /> </form>
Now postbacks can be sent in a send.php script:
$url = 'http://POSTBACK_URL?payout=100&status=sale&subid=' . urlencode($_POST['subid']); file_get_contents($url);
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']); file_get_contents($url);
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
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.
Updating parameters of a click on JS
<script type="text/javascript"> kUrl='http://keitaro_url/'; function update_tokens(subId, param, value) { var img = document.createElement("img"); img.src= kUrl + '?_update_tokens=1&sub_id=' + subId + '&'+ param + '=' + value + '&return=img'; img.height=0; img.width=0; document.getElementsByTagName("body")[0].appendChild(img); } </script>
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
session_start(); 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'))