# KClient JS
advanced expert team enterprise
KClient JS works the following way:
- KClient JS requests the campaign from the tracker;
- KClient JS tries to execute the flow action. It can be a landing page.
As a result, a new content is displayed on the original site under the same domain.
The script is suitable for online site builders, where it is impossible to use KClient PHP
WARNING
Important
KClient JS is only attached to the sites, that are hosted on the third-party hosts, or servers. Do not add KClient JS code to a site or webview that is loaded as a local landing page / offer in Keitaro.
On working with KClient JS, the campaign tracking link is a link to the site, where the tracking code from the Keitaro campaign is added. The traffic path on working with KClient JS: a site with a tracking code -> Keitaro -> executing actions, and settings of the campaign, from which the tracking code is taken.
The domain parked to Keitaro and the domain of the site, where you put the tracking code must be two different domains with active SSL-certificates (working on HTTPS).
# Getting KClient JS
- Go to Tracking tab in a campaign's settings;
- Select "KClient JS":
HTTPS
KClient JS is available only if campaign is assigned to a domain with HTTPS.
# Settings
After you select KClient JS solution on Tracking tab, you'll see the basic settings:
- Save only unique clicks - this feature allows saving only unique clicks in Keitaro stats.
- Convert to base64 - converts the integration code to base64 which makes the code unique and protects the code from blocking with browser extensions.
- Integration Code - the final piece of the code you need to insert.
TIP
If Save only unique clicks is turned on, and you need to test your campaign, add a new parameter &_new=1
to the page URL.
Example:
https://example.com/?_new=1
# Integrating with site builders
# Shopify
Open your store and go to Themes → Actions → Edit code.
Select the page you need in the menu from the left. In case you need the main page, select theme.liquid.
Add the code from Keitaro to <head>
tag:
Save the changes. The campaign is integrated.
# Taplink
Create your page, go to the Settings → General → Insert HTML code
Use plain JS.
Opt out Convert to base64 option before copying the integration code.
Save the changes.
# Tilda
Create your site and open the list of the pages, click Settings;
Go to the Additional page and scroll down to HTML code to add inside the HEAD field;
Add the JS code.
Note
This feature is available only for paid plans.
After adding the code, publish the changes.
# Flexbe
Create your site and go to Settings in the upper menu;
Click Code Injection and check before closing
<head>
tag;Import your code:
# GitHub Pages
- Create a new repository:
- Open Index and insert JS code:
- Save and deploy. Now, when somebody opens a page from your repository, JS code will be executed:
# KClient JS FAQ
How to filter bots?
The basis of the standard case includes a campaign with two flows, where the first flow has filters for bots and the action "Do nothing", which will leave the bot on the site where the script is put. The second flow with the target Action, for example, local landing page:
In the "Bot Protection" flow add any set of filters to catch bots.
In "Flow 2" add the target action. If a local landing page is selected in the flow, then this landing page, or offer will be uploaded to your site with the integration without redirecting and changing the domain for the traffic, which does not get into the bot flow.
What are the incompatible site builders?
- WIX.
- Google.Sites.
Nothing happens while visiting the site with the code.
First, go to your campaign in Keitaro, click the "Log" button above the flows and check if there is a record of your click. If the log is empty, that means there's no inquiries to Keitaro, JS is not executed.
Make sure you put the integration code correctly. The code must be inserted to <head>
tag. Check if there are
mistakes, if you added extra characters when copying, or there are symbols not allowed for JS.
Also, make sure that the site and the tracker have domains with SSL certificates installed (the work is carried out within the HTTPS protocol) and the JS script in the tracker was generated with the SSL domain (that means, you use HTTPS domain in Keitaro by default).
The click is recorded in Keitaro log, but nothing happens when visiting the site.
Read the traffic log and check if the click got to the necessary flow, and whether the action, which the click performed, coincides with the one you set in the flow. If the log says that there was a redirect, but in fact it wasn't, or it worked incorrectly (the site loaded without styles or with a floating layout), then make sure that you work with HTTPS protocols in both cases (the site and the tracker).
Eternal redirect when you visit a site with KClient JS.
Check the flows if there is a link to your site with integration. This site URL shouldn't be added to a flow. It causes an eternal redirect, since the visit to the site launches your campaign, in which the flow contains a link to the site with the KClient JS code again. It turns out to be a vicious circle.
MIXED CONTENT error in a browser console when visiting a site with KClient JS.
Make sure that you work with HTTPS protocols in both cases (the site and the tracker). If #1 does not help, check the browser console and find the resources that are used with HTTP, and change their URLs to HTTPS. If you work with a domain through Cloudflare, make sure that "Flexible or Full" settings of SSL are set in Cloudflare configuration.