How to fix it #3: Resolving issues with KClient PHP

KClient PHP (formerly Click API v3) is one of the Keitaro integrations methods which connects third-party websites with a PHP code and dynamically changes the content without a visible redirect. This integration type is very popular while working with a website where PHP is allowed and for mobile apps webview. 

We will describe the most common issues and their solutions while working with KClient PHP.

First of all, go to your campaign in Keitaro, click the Log button above the streams and check if there is a record of your click.
If the log is empty that means there are no inquiries to Keitaro, the PHP script is not executed. We can enable the debug mode and check the errors.

To enable the debug mode add the following piece of the code before integration code (after <?php):

ini_set('display_errors', 'on');

error_reporting(7);

And add the line after

$client->executeAndBreak() :
$client->showLog();

This code will show the debug information on the website.
The final variant of the code will look like the following:

Another alternative way of enabling the debug mode is enabling it on a client. To do this, uncomment the line:

delete “//” in the beginning of the line.

// $client->debug(); // to enable debug mode and show the errors

If there’s still nothing shown on a website KClient PHP is not enabled.

Solutions

  1. Check if there’s a kclient.php file in the directory with a website index. This file is necessary for KClient PHP correct work besides the piece of code which should be added to the top of the index page. 
  2. Check if there are extra characters or spaces in the integration code or right before the code. Often, when copying, extra characters may appear in the code, if the integration does not work, check the code again.
  3. Check the index file extension. It should be only “.php”.

In case you see only:
Requested: https://tracker.com/api.php 

That means the domain from the tracker is not available for this website because of various reasons – DNS cache, blocking, or the domain doesn’t work. Change the domain. 

In case there’s a traffic log in Keitaro with the action performed (redirect or loading the lander), but actually nothing happens in a browser – check your index.php encoding. Your file may be saved as utf-8 with BOM. Resave the file with UTF-8 without BOM encoding. 

In case you checked all the steps above but couldn’t solve the issue, reach out to our support team, we will be happy to help out.