# General description

Keitaro supports many ways of integrations - starting from a simple link as well as a server-side integration with KClient PHP.

# URLs

URL is used for advertising networks. Copy URL and paste it to the ad.

In case the traffic source is selected for the campaign, all necessary params will be added automatically.

//Advantages//

Can be used in advertising networks. Suitable for links. Doesn’t require PHP and JS.

//Disadvantages//

Doesn’t transfer parameters from URL as a link.

Example: http://demo-en.keitaro.io/LNtLfH

The simplest way to integrate a campaign with any website. Copy the link code and paste to a website page. All necessary parameters will be sent automatically.

//Advantages//

Transfers all the parameters and a referrer from the pages the link is placed at.

//Disadvantages//

Can’t be used in advertising networks.

Example:

<span id="b95f5089-8280-0c00-8aeb-cbaa2e806fd2"></span>
<script type="application/javascript">
document.getElementById('b95f5089-8280-0c00-8aeb-cbaa2e806fd2').innerHTML = '<a href="//demo-en.keitaro.io/LNtLfH?se_referrer=' + encodeURIComponent(document.referrer) + '&default_keyword=' + encodeURIComponent(document.title) + '&'+window.location.search.replace('?', '&')+'">Link</a>';
</script>

# Redirects

# Forced PHP-redirect

This PHP code immediately redirects visitors to the campaign. Insert it to the page which should redirect visitors.

# iframe

Creates iframe tag and loads the campaign inside of it. This code creates an iframe block and loads the campaign inside it.

To show a full-screen frame select “Frameset” integration method.

//Advantages//

Can be used with website builders. Can be used for redirects and to show anything on the page.

//Disadvantages//

Executed as a JS-code. Can be blocked by an AdBlock.

Example:

<div id="af33487ac-1ec5-e4a5-4c78-74906e466ac4"></div>
<script type="application/javascript">
document.getElementById('af33487ac-1ec5-e4a5-4c78-74906e466ac4').innerHTML = '<iframe sandbox="allow-top-navigation allow-scripts allow-popups allow-forms" frameborder="0" width="" height="" src="//demo-en.keitaro.io/LNtLfH?se_referrer=' + encodeURIComponent(document.referrer) + '&default_keyword=' + encodeURIComponent(document.title) + '&'+window.location.search.replace('?', '&')+'&frm5fe47fd1c6030=frame5fe47fd1c6031"></iframe>'
</script>

Check the list of redirects and actions compatability for more info.

# Script (async)

This code creates a <script> element on the web page, so it can execute any JS code in user's browser.

The usage: to execute redirects from the streams (redirect type - “Redirect for Script”) or for loading external scripts ( action “CURL”).

If the website with the code uses HTTPS, the tracker should use HTTPS as well.

//Advantages//

Can be used with website builders. Can be used to launch JS scripts.

//Disadvantages//

Waits for the entire page to load. Can be blocked by an AdBlock.

Example:

<span id="39565102-ee14-5a6a-d667-277bc71533a5"></span><script type="application/javascript">
var d=document;var s=d.createElement('script'); 
s.src='//demo-en.keitaro.io/LNtLfH?se_referrer=' + encodeURIComponent(document.referrer) + '&default_keyword=' + encodeURIComponent(document.title) + '&'+window.location.search.replace('?', '&')+'&frm5fe47fd1c6039=script5fe47fd1c603a&_cid=39565102-ee14-5a6a-d667-277bc71533a5'; 
if (document.currentScript) { 
document.currentScript.parentNode.insertBefore(s, document.currentScript);
} else {
d.getElementsByTagName('head')[0].appendChild(s);
}
if (document.location.protocol === 'https:' && '//demo-en.keitaro.io/LNtLfH?se_referrer=' + encodeURIComponent(document.referrer) + '&default_keyword=' + encodeURIComponent(document.title) + '&'+window.location.search.replace('?', '&')+'&frm5fe47fd1c6039=script5fe47fd1c603a'.indexOf('http:') === 0 ) {alert('The website works on HTTPS. The tracker must use HTTPS too.');}
</script>

# Script (sync)

An outdated way of creation a script with document.write. Chrome announced blocking this type of scripts insertion.

If the website with the code uses HTTPS, the tracker should use HTTPS as well.

//Advantages//

Can be used with website builders. Can be used to launch JS scripts. Executed without waiting for the entire page to load.

//Disadvantages//

Is blocked by Chrome when the network speed is low (3G). Can be blocked by an AdBlock.

Example:

<script type="application/javascript">
document.write('<script type="application/javascript" src="//demo-en.keitaro.io/LNtLfH?se_referrer=' + encodeURIComponent(document.referrer) + '&default_keyword=' + encodeURIComponent(document.title) + '&'+window.location.search.replace('?', '&')+'&frm5fe47fd1c6047=script5fe47fd1c6048"><' + '/script>');
</script>

# Frames

# Static Frameset

This code creates fullscreen frame (html frameset). Put the code instead <body> tag. Frameset won't work if there's a <body> tag on a page.

//Advantages//

Shows the page on the entire screen. No intermediate redirect.

//Disadvantages//

Loses URL parameters. Can’t be used with website builders (because of the <body>.)

Can be blocked by an AdBlock.

Example: <frameset rows="100%"><frame src="//demo-en.keitaro.io/LNtLfH?frm5fe47fd1c6015=frame5fe47fd1c6018"></frameset>

# Dynamic Frameset

This code creates fullscreen frame (html frameset) with parameters (UTM-marks) transferring.

Make sure that the page doesn't contain a <body> tag.

//Advantages//

Shows the page on the entire screen. No intermediate redirect. Transfers URL parameters.

//Disadvantages//

Can’t be used with website builders (because of the <body>.)

Can be blocked by an AdBlock.

Example:

<script type="application/javascript">
document.write('<frameset rows="100%"><frame src="//demo-en.keitaro.io/LNtLfH?se_referrer=' + encodeURIComponent(document.referrer) + '&default_keyword=' + encodeURIComponent(document.title) + '&'+window.location.search.replace('?', '&')+'&frm5fe47fd1c6026=frame5fe47fd1c6027"></frameset>')
</script>

# Other

# QR-code

Creates a QR-code for your campaign. //Advantages//

Can be used on printed stuff.

//Disadvantages//

Very narrow scope.

Example:PICTURE

# Tracking Script

The tracking script collects information about visitors, generates offers links and report conversion. Please, use it only if you can't send traffic straight to campaign URL.

//Advantages//

Supports links to offers and multi-offers. Can send postbacks. No intermediate redirect. Supports redirects.

//Disadvantages//

Difficulty in integration. Regularly banned by Google.

Example:

<!-- Keitaro tracking script -->
<script type='application/javascript'>
if (!window.KTracking){window.KTracking={collectNonUniqueClicks: false, multiDomain: false, R_PATH: '//demo-en.keitaro.io/LNtLfH', P_PATH:'//demo-en.keitaro.io/f1ec56f/postback', listeners: [], reportConversion: function(){this.queued = arguments;}, getSubId: function(fn) {this.listeners.push(fn);}, ready: function(fn) {this.listeners.push(fn);} };}(function(){var a=document.createElement('script');a.type='application/javascript';a.async=true;a.src='//demo-en.keitaro.io/js/k.min.js';var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(a,s)})();
</script><noscript><img height='0' width='0' alt='' src='//demo-en.keitaro.io/LNtLfH'/></noscript>

# Pixel for Email

That code creates an img tag. When user load the image you'll get information about it.

//Advantages//

Pure HTML, no JS.

//Disadvantages//

Doesn’t support redirects. Not all email clients display pictures without consent.

Example: <img height='1' width='1' alt='' src='//demo-en.keitaro.io/LNtLfH?frm5fe47fd1c606d=img5fe47fd1c606e'/>

# KClient PHP

KClient PHP allows you to make requests to the tracker and just show the result to the visitors.

//Advantages//

Executed on a server side. Supports offers and multi-offers. Compatible with all types of actions and redirects.

//Disadvantages//

Requires PHP support on a website. Requires manual copying of a kclick_client.php file.

Example:

<?php
// Query params are:  

require_once dirname(__FILE__) . '/kclient.php';
$client = new KClient('http://demo-en.keitaro.io/api.php?', 'fdmj4xfn7tkcc4cbdnbw85hxq4jhp4wn');
$client->sendAllParams();       // to send all params from page query
$client->forceRedirectOffer();       // redirect to offer if an offer is chosen
// $client->param('sub_id_5', '123'); // you can send any params
// $client->keyword('PASTE_KEYWORD');  // send custom keyword
// $client->currentPageAsReferrer(); // to send current page URL as click referrer
// $client->debug();              // to enable debug mode and show the errors
// $client->execute();             // request to api, show the output and continue
$client->executeAndBreak();     // to stop page execution if there is redirect or some output
?>

# KClient JS

KClient JS is based on a KClient PHP solution, but allows to integrate JS websites.

# WordPress

Integrating Keitaro and a WordPress website.

//Advantages//

Native WordPress plugin. Supports offers and multi-offers. Compatible with all types of actions and redirects.

//Disadvantages//

Difficult to set up when there’s an order form on a website.

Step-by-step guide on WP plugin integration. (opens new window)

# Banners

This code creates iframe block. Inside the block it shows the banners. Compatible with almost all types of HTML Ads and RTB system scripts.

To show popups, popovers, sliders use JS Ads.

//Advantages//

Compatible with many types of the banners including Adsense.

//Disadvantages//

The block is always drowned even if there are no banners. Doesn’t support popunder, message, etc.

Example:

<div id="a3f2c648e-fe6a-b3d9-9379-346d916cc3ce"></div>
<script type="application/javascript">
var w=240var h=240document.getElementById('a3f2c648e-fe6a-b3d9-9379-346d916cc3ce').innerHTML = '<iframe frameborder="0" width="'+w+'" height="'+h+'" src="//demo-en.keitaro.io/LNtLfH?se_referrer=' + encodeURIComponent(document.referrer) + '&default_keyword=' + encodeURIComponent(document.title) + '&'+window.location.search.replace('?', '&')+'&frm5fe47fd1c604f=frame5fe47fd1c6050"></iframe>'
</script>

This code shows banners in the context of the webpage. It might be incompatible with some JS-scripts.

//Advantages//

Shows the ad right on the page, without the frame.

//Disadvantages//

Limited list of supported advertisements.

Example:

<span id="66d3b8d3-df3f-69a3-6e4f-cf3219ba33c8"></span>
<script type="application/javascript">
var d=document;var s=d.createElement('script'); 
s.src='//demo-en.keitaro.io/LNtLfH?se_referrer=' + encodeURIComponent(document.referrer) + '&default_keyword=' + encodeURIComponent(document.title) + '&'+window.location.search.replace('?', '&')+'&frm5fe47fd1c6058=script5fe47fd1c6059&_cid=66d3b8d3-df3f-69a3-6e4f-cf3219ba33c8'; 
d.getElementById("66d3b8d3-df3f-69a3-6e4f-cf3219ba33c8").appendChild(s);
</script>

# JS Ads (slider, topline, video, popunder, clickunder)

This method allow to use complex ad formats, like popups, popuaders, topups.

//Advantages//

Shows complex dynamic formats (popunder, message). No frame.

//Disadvantages//

Supports not all ad network scripts.

Example:

<script type="application/javascript">
var d=document, sc = d.getElementsByTagName('script')[0];
var s=d.createElement('script'); 
s.type='text/javascript'; s.async = true;
s.src='//demo-en.keitaro.io/LNtLfH?se_referrer=' + encodeURIComponent(document.referrer) + '&default_keyword=' + encodeURIComponent(document.title) + '&'+window.location.search.replace('?', '&')+'&frm5fe47fd1c6060=script5fe47fd1c6061&_cid=3fdf462e-f2c3-fc86-cac5-bc9ffbc536b1' + '&'+new Date().getTime(); 
sc.parentNode.insertBefore(s, sc.nextSibling);
if (document.location.protocol === 'https:' && '//demo-en.keitaro.io/LNtLfH?se_referrer=' + encodeURIComponent(document.referrer) + '&default_keyword=' + encodeURIComponent(document.title) + '&'+window.location.search.replace('?', '&')+'&frm5fe47fd1c6060=script5fe47fd1c6061'.indexOf('http:') === 0 ) {alert('The website works on HTTPS. The tracker must use HTTPS too.');}
</script>
<span id="3fdf462e-f2c3-fc86-cac5-bc9ffbc536b1"></span>
  • URLs
  • JS-generated Link
  • Redirects
  • Frames
  • Other
  • Banners