Binom Documentation

Go to navigation

Click API

Click API is a flexible low-level tool for managing clicks in the Binom tracker. It can be used to implement complex click processing scenarios that are not possible with the basic tracker functionality: regular and integrated landing pages, LP pixel.

Note that Click API is not compatible with Magicchecker.

How it works

Click API is a PHP script that you can connect to your landing page.

The main difference between Click API and LP pixel or integrated landing pages is that you can independently set the condition for the click action.

For example, you have a landing page where clicking a button opens an offer on the same page. To track redirects to an offer, Binom uses the Click URL function, but for such a method, a real redirect from the landing page to the offer page is required. Click API can help you here: you can bind the event of redirecting from the landing page to the offer by using the function $binomClickAPI->setLPClick(); for any action on the landing page. For example - clicking a button without a real redirect to another page.

A detailed description of the most common cases of using Click API can be found in possible scenarios section.

Note that when using Click API, the click is sent to the tracker after the redirect to the landing page, which limits the accuracy of device model identification using Client hints in Google Chrome.

If you need to maintain the accuracy of device model identification in your campaign, we recommend using integrated landers as an alternative.

Connecting to a landing page

Go to Settings >> Click API and copy the Click API code from here.

Next, you need to add the script to the beginning of the code of your landing page and save the landing page in .php format.

After that, you need to set the campaign you want to send clicks from this landing page to. To do this, you need to replace key in the line const CAMPAIGN_KEY = "key" with the real key of your campaign.

If you want to use one landing page with multiple campaigns, see the possible scenarios section.

You can also connect Click API as a separate file. In order to do this - use one of the following instructions at the beginning of the .php code of your landing page:

— include
— require
— include_once
— require_once

Available functions

Function Description
$binomClickAPI = new BinomClickAPI(); Service function required to initialize the script.
$binomClickAPI->sendBaseClick(‘campaign_key_optional’); Add a click to the tracker. This is a required function, no other function will work without it.
$binomClickAPI->loadLanding() Load the landing page.
$binomClickAPI->setLPClick(); Add an LP click to the tracker.
$binomClickAPI->getRedirectURL(); Get the link to generate an LP click.
$binomClickAPI->getClickInfo(); Get all information about the click.
$binomClickAPI->getLandingUrl(); Get the link to the landing page.
$binomClickAPI->getOfferUrl(); Get the link to the offer.
$binomClickAPI->getResponse(); Get the tracker's response to the previous request.

Possible scenarios


Sending a click to an offer


To send a click directly to the offer link and count LP CTR in the tracker at the same time, use the following code:


<a href="<?= $binomClickAPI->getOfferUrl(); ?>" onclick="navigator.sendBeacon('<?= $binomClickAPI->getRedirectURL(); ?>')" >Link to an offer</a>

One landing page for multiple campaigns


If you want to use one landing page with Click API for multiple campaigns, you need to replace campaign_key_optional in the function $binomClickAPI->sendBaseClick(‘campaign_key_optional’); with the key of the required campaign and then, each time you need to add a click to the campaign you specified, call this function.