Reporting Clicks and Impressions - Javascript Library

The JavaScript Library (formerly the JavaScript SDK) makes it possible to send reports of clicks and impressions to CitrusAd.

CitrusAd Javascript Library

To send reports of impressions and clicks, use the CitrusAd Javascript Library.

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

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

<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>