Integration Guide

Before You Begin

Before implementing AdTag on your site, you'll need to receive the following from us:

  1. Publisher Token: A unique token that authenticates your domain (YOUR_TOKEN)
  2. Publisher ID: Your numerical publisher identifier (YOUR_PUBLISHER_ID)
  3. Placement IDs: Numerical identifiers for each ad location on your site

Contact your account manager to receive these credentials before proceeding.

Quick Setup

Step 1: Add the Tag Container

First, add a container element where you want the ad to appear:

<div id="scrptk-container"></div>

Step 2: Load the SDK

Add this script to your page, preferably in the head or just before the closing body tag:

<script src="https://sdk.scrptk.com/tag.js?token=YOUR_TOKEN"></script>

Replace YOUR_TOKEN with the publisher token we provided.

Step 3: Initialize an Ad Placement

Add this script after the SDK is loaded:

<script>
  // Initialize the ad
  Tag.create({
    publisherId: 'YOUR_PUBLISHER_ID',
    placement: 'YOUR_PLACEMENT_ID',
    target: '#scrptk-container'
  });
</script>

Replace:

Reccomended Setup

Fail-Safe Loading Method

For production sites, we recommend this fail-safe loading pattern:

<div id="scrptk-container"></div>

<script>
  (function(w, d, s, id) {
    // Skip if already loaded
    if (d.getElementById(id)) return;

    // Create script element
    var js = d.createElement(s);
    js.id = id;
    js.src = "https://sdk.scrptk.com/tag.js?token=YOUR_TOKEN";
    js.async = true;

    // Initialize when loaded
    js.onload = function() {
      if (w.Tag) {
        Tag.create({
          publisherId: 'YOUR_PUBLISHER_ID',
          placement: 'YOUR_PLACEMENT_ID',
          target: '#scrptk-container'
        });
      }
    };

    // Add to page
    var firstScript = d.getElementsByTagName(s)[0];
    firstScript.parentNode.insertBefore(js, firstScript);
  })(window, document, 'script', 'tag-sdk-' + Math.random().toString(36).substring(2, 7));
</script>

Context Data (Recommended)

Add context data to improve ad targeting and relevance:

Tag.create({
  publisherId: 'YOUR_PUBLISHER_ID',
  placement: 'YOUR_PLACEMENT_ID',
  target: '#scrptk-container',
  context: {
    subaff1: '12345',
    subaff2: '404 Page',
    subaff3: 'Google Display',
    subaff4: 'Unique Visitor',
    email: 'test@gmail.com',
    firstName: 'John',
    lastName: 'Smith',
    gender: 'M',
    age: '36',
    city: 'Springfield',
    state: 'MA',
    zip: '01111',
    clickid: 'YOUR_TRANSACTIONID'
  }
});

Available Context Parameters

Tracking Parameters

Parameter Type Description Example Required
subaff1 String Subaffiliate Identifier eg. 22858 Yes
subaff2 String Placement Type Identifier eg. "Thank You" Page, Post-Registration No
subaff3 String Traffic Type Identifier eg. Facebook, Google Search, Path No
subaff4 String Audience Name Identifier eg. Homeowner, Car Owner, Purchaser No
clickid String User + Click Identifier eg. TransactionId, ClickId No

User Information

Parameter Type Description
email String User's email address
emailmd5 String MD5 hash of email
emailsha256 String SHA256 hash of email
phoneNumber String User's phone number
firstName String User's first name
lastName String User's last name
address1 String Address line 1
address2 String Address line 2
city String City
state String State/province
zip String Postal/ZIP code
gender String User's gender (M/F)
dobDay String Day of birth
dobMonth String Month of birth
dobYear String Year of birth
age String User's age
Important: Always ensure you have proper user consent before collecting and sharing user information. Follow applicable privacy regulations in your jurisdiction.

Server Postbacks

Track conversions in real-time by configuring server-to-server postbacks. When a payable conversion occurs, we'll automatically notify your server with the conversion details.

Setting Up Postbacks

To receive conversion notifications, provide your postback URL to your Account Manager and pass your transacionId into the context clickid field when initatlizing the Tag.

Tag.create({
  publisherId: 'YOUR_PUBLISHER_ID',
  placement: 'YOUR_PLACEMENT_ID',
  target: '#scrptk-container',
  context: {
    clickid: 'YOUR_UNIQUE_TRANSACTION_ID'
    // ... other context parameters
  }
});

Postback Parameters

When a conversion occurs, we'll make a GET request to your postback URL with the following query parameters:

Parameter Description Example Value
{clickid} Your unique transaction ID passed via the clickid parameter ABC123XYZ789
{payout} The conversion payout amount in USD 12.50

Example Postback Request

When you pass a clickid of ABC123XYZ789 and a conversion worth $12.50 occurs, we'll call:

GET https://yourserver.com/conversion?tid=ABC123XYZ789&revenue=12.50

Display Example

Once implemented, the AdTag can display ads in various formats depending on your configuration. Each format designed for different user experiences and monetization goals.

View Example.

Implementation Checklist

Support

For integration assistance or questions, contact your account manager.