Today, we will walk you through the KClient PHP integration step by step and connect it to a remote site. To show you how this works, let’s set up our campaign so that the bots stay on our site and the clients get to the target offer.
Table of contents:
- Connecting to a remote site via SFTP
- KClient PHP integration
A few words about the integration:
KClient PHP (formerly Click API v3) is one of Keitaro’s integration methods that allows you to connect to remote resources via PHP code and do a dynamic content replacement without a visible redirect. This method is suitable for any remote sites that accept PHP code and for importing mobile applications into WebView.
For the integration to work, we need a remote site with FTP access and a created campaign in Keitaro.
First of all, let’s create our campaign:
We create two streams. The first stream has the Do Nothing action and the BOT filter. That will allow us to leave bots on the site.
We will use the second stream for our clients. Here, we can add a link to a redirect, an offer, and a landing page. This all depends on your traffic funnel.
This setting will allow us to leave bots on the site and direct clients to wherever we want.
After creating these streams, go to the Integration tab and select KClient PHP.
Pay attention to the Campaign Link field.
For the integration to work correctly, you need a parked domain.
Also, if the domain parked to the campaign protocol is HTTP, then the site domain where we put the integration should be HTTP too. Similarly, if you want to use HTTPS, both domains must have an SSL certificate.
Connecting to a remote site via SFTP
After we have created our campaign, we need to connect to our remote site via SFTP. The connection process is shown in detail in our video.
Having connected, we need to go to the directory and find the site (page) index file for which we want to make the integration.
KClient PHP integration
Return to the page with our campaign and the Integration tab and copy the client code.
Then open our index and paste the code at the very beginning of the file (before <html> and DOCTYPE). Do not forget to change the extension of the index file from .html to .php if necessary.
An important condition for adding and saving the file with the code of your site is the absence of a BOM in the Utf-8 encoding.
BOM (Byte Order Mark) is a symbol in the form of U + FEFF.
This can be done using a regular text editor:
We also need the client file itself. You can move it there — see the bottom of the Integration page.
Download it to the file and load it next to the index file where we just inserted the integration code.
At this point, the main stage of integration is complete. Now, when you go to the site’s main page, in the code of which we added the integration, you can see the Keitaro campaign we created.
You can check the client’s work using the Traffic Log in the campaign. Go to an integrated site; the log should show the click and the action is taken (Redirect to the offer, Do nothing, etc.).
For more details on how to read the Traffic Log correctly, see our article «How to read the Traffic Log correctly».
And of course, in case of any questions, you can always write to us in Support by either using the chat function on the keitaro.io website or through the Telegram bot.