Reporting Clicks and Impressions

You will need to get your Base URL from CitrusAd before you are able to report impressions and clicks to CitrusAd.

CitrusAd Javascript Library - Web integrations

The JavaScript Library (formerly the JavaScript SDK) makes it possible to send reports of clicks and impressions to CitrusAd. The Javascript Library adds more tracking information and is advised for web based integrations.

The setup is straightforward. The API currently exposes two methods.

<script type="text/javascript" src="https://assets.citrusad.net/citrusjs/1.2.0/citrus.js"></script>
<script type="text/javascript">
var citrusAd = CitrusAd.init(
'Get base URL from Citrus for your proper environment and region',
{
disableTracking: false, // Optional: defaults to false.
trackingOptions: {
sessionId: 'YOUR_OWN_TRACKING_TOKEN' // Optional, this token can be used to tie impressions/clicks with a session token that you maintain
}
}
);
citrusAd.reportClick('adId').then(function (result) {
console.log(result);
}).catch(function (error) {
console.log(error);
})
citrusAd.reportImpression('adId').then(function (result) {
console.log(result);
}).catch(function (error) {
console.log(error);
})
</script>

Here is how to include a file using a script tag:

<script type="text/javascript" src="https://assets.citrusad.net/citrusjs/1.2.0/citrus.js"></script>

Directly Reporting Clicks & Impressions - App & Other Integrations

If you are integrating and are unable to use the Javascript Library, you can send a GET request and report the click or impression event. Clicks and impressions are reported in the same structure. Impressions are reported to the first-i resource, and clicks are reported to the second-c resource.

Calling endpoints should occur within the app or website.

Reporting Impressions

To report an impression you will send a GET request in the format below:

https://$BASE_URL.citrusad.com/v1/resource/first-i/AD_ID

The AD_ID will be the adId returned to you with the ad you are reporting an impression for. An example GET request would be:

https://$BASE_URL.citrusad.com/v1/resource/first-i/display_xw3ybbrymHT_D3VwU3Ic5ThUkbhFNkY4NVNIODU4NEVGRkdT

In the above, display_xw3ybbrymHT_D3VwU3Ic5ThUkbhFNkY4NVNIODU4NEVGRkdT is the adId you are reporting an impression for.

Reporting Clicks

To report a click you will send a GET request in the format below:

https://$BASE_URL.citrusad.com/v1/resource/second-c/AD_ID

The AD_ID will be the adId returned to you with the ad you are reporting a click for. An example GET request would be:

https://$BASE_URL.citrusad.com/v1/resource/second-c/display_xw3ybbrymHT_D3VwU3Ic5ThUkbhFNkY4NVNIODU4NEVGRkdT

In the above, display_xw3ybbrymHT_D3VwU3Ic5ThUkbhFNkY4NVNIODU4NEVGRkdT is the adId you are reporting a click for.