AdSecurity Platform Tracking Javascript SDK
- Introduction
- Installation
- General Usage
- Detecting Fraud in the Response
- Track Clicks
- Track Impressions
- Track Conversions
- Track Conversions using Transaction ID
1. Introduction
The AdSecurity Platform Tracking Javascript SDK is a library that allows you to track impressions, clicks and conversions from your website and send them to the AdSecurity Platform. This SDK is designed to be used in conjunction with the AdSecurity Platform to track the performance of your ads and campaigns.
2. Installation
To install the AdSecurity Platform Tracking Javascript SDK, you need to include the following script tag in the <head> section of your website:
<script src="https://asp-assets.b-cdn.net/lib/index.js"></script>
3. General Usage
The SDK provides three main functions:
ASP.trackClick({}) // Track Clicks ASP.trackImpression({}) // Track Impressions ASP.trackConversion({}) // Track Conversions
You must pass these required parameters to each function:
ASP.trackClick({ integrationID: '{integrationID}', offer: '{offer}', publisher: '{publisher}' });
You can also pass additional parameters to each function to track custom data:
ASP.trackClick({ integrationID: '{integrationID}', offer: '{offer}', publisher: '{publisher}', sub_id: '{sub_id}', sub_id2: '{sub_id2}', sub_id3: '{sub_id3}', sub_id4: '{sub_id4}', sub_id5: '{sub_id5}', sub_id6: '{sub_id6}' });
4. Detecting Fraud in the Response
Each function returns a Promise that resolves with the response data from the AdSecurity Platform. If the AdSecurity Platform detects fraud, the response will include a status field with the value rejected and reason field with the reason for the rejection.
ASP.trackClick({ integrationID: '{integrationID}', offer: '{offer}', publisher: '{publisher}' }).then(function(response) { console.log(response); // {"status": 200, "data":{"status": "rejected", "reason": "VPN"}} });
5. Track Clicks
To track clicks, you need to call the ASP.trackClick function with the following parameters:
ASP.trackClick({ integrationID: '{integrationID}', offer: '{offer}', publisher: '{publisher}' }).then(function(response) { console.log(response); // {"status": 200, "data": {"status": "approved", "transaction_id": "01HVMM5SAS879C0A });
6. Track Impressions
To track impressions, you need to call the ASP.trackImpression function with the following parameters:
ASP.trackImpression({ integrationID: '{integrationID}', offer: '{offer}', publisher: '{publisher}' }).then(function(response) { console.log(response); // {"status": 200, "data": {"status": "approved", "transaction_id": "01HVMM5SAS879C0A });
7. Track Conversions
To track conversions, you need to call the ASP.trackConversion function with the following parameters:
ASP.trackConversion({ integrationID: '{integrationID}', offer: '{offer}', publisher: '{publisher}', revenue: '{revenue}', payout: '{payout}' }).then(function(response) { console.log(response); // {"status": 200, "data": {"status": "approved", "transaction_id": "01HVMM5SAS879C0A })
8. Track Conversions using Transaction ID
Tracking conversions using transaction_id is recommended for tracking conversions if you are using the AdSecurity Platform Click API. To track conversions with the transaction ID from the click API response, you need to call the ASP.trackConversion function with the following parameters: If the transaction_id parameter is not provided, the SDK will try to look for the transaction ID from the domain cookies.
ASP.trackConversion({ integrationID: '{integrationID}', transaction_id: '{transactionID}', // Optional }).then(function(response) { console.log(response); // {"status": 200, "data": {"status": "processing"}} })
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article