Saving conversions on a website with a tracking script and an order form

In this manual, we will set up sending conversions to Keitaro from a website with an order form integrated with a tracking script.

Integrating a tracking script

Create a campaign in Keitaro.

Next go to Integrations tab and select the Tracking script:

Insert the code from Keitaro to a <head> tag on your landing page.

Now we need the code for sending conversions.

Setting up the conversions sending

Copy the following code:

<script type='application/javascript'>
function reportConversion(el, status, params) {
    var form = (el && el.form) ? el.form : el;
    var params = {};
    [].map.call(form.elements, function(el) {
      if (el.name != '') {
          params[el.name] = el.value;  
      }
    });
    KTracking.reportConversion(0);
    return true;
};
</script>

Insert the code to the <head> tag below the previously inserted code:

Now we need to add sending the conversions code under the button of sending the order.

This is the code:

onclick="reportConversion(event.target, status, params)"

You can add the status and the payout sum, e.g.:

<button onclick="reportConversion(event.target, 'lead', {payout: 10})">Order now</button>

Insert this code under each of the buttons if there are more than one button on a landing page:

Save the index.html file and upload it to the hosting. You can check the conversions log at Maintenance > Logs > Received postbacks in Keitaro.

Setting up subid (optional)

If the traffic goes to the website through the Keitaro campaign link not to the website link directly, you need to configure the transfer of the “_subid” parameter in order to exclude duplicate clicks. Just add “& _subid = {subid}” to the offer URL:

https://website.ru/?_subid={subid}

In case of any questions left feel free to reach out, we will be happy to help out.

author avatar
Grigoriy B.