Tracking code integration using Google Tag Manager

  • Zaktualizowano

Integration is a process in which you set up how to send information on target actions performed on your website to the Admitad system.

A target action is a purchase, registration, completed application, or other expected action performed by a user whom an Admitad publisher led to your website.

General information. Features and tips

  • You can only initiate integration if your program has the following:
    • A tracking link generated in General Settings.
    • A target action added and a related rate set up in Actions.

If you don't have a manager, you'll need to generate a tracking link on your own (see this guide) and add at least one action and at least one rate (see this guide).
If you have a personal manager, they'll do this for you.

  • Integration is a mandatory step to continue your work and launch an affiliate program with Admitad.

  • To speed up the integration, we recommend involving your technician and providing them with these instructions.

Once the integration is complete, all target action details (date, order ID, order amount, etc.) will be sent to Admitad automatically.

What a tracking code is, and how it works via Google Tag Manager

A tracking code is a JavaScript code that registers target actions users perform on your website and sends this data to the Admitad server.

During tracking code integration using Google Tag Manager, an integration code is deployed in a special container of this service rather than on your website.
Since Google Tag Manager isn't an Admitad product and can be blocked by browser extensions, we recommend deploying a tracking code on your website using this guide.

How it works: When a user performs a target action on your website, the tracking code is initialized in Google Tag Manager. At that moment, a GET request containing target action data (order amount, order ID, currency, etc.) is sent to the Admitad server.

The received data is recorded and displayed in the Reports section of your Admitad account.

How to perform tracking code integration using Google Tag Manager

To integrate a website using a tracking code via Google Tag Manager (GTM), follow these steps (a guide for each is provided below):

How to prepare for deploying a tracking code with GTM

Before deploying a tracking code, make sure GTM (https://tagmanager.google.com/) is set up and ready:

  • You've signed up, set up your account, and installed GTM (see this guide)
  • You've set DataLayer variables to send target action information (see this guide)
  • You've initialized the DataLayer on the 'Thank you' page (see this guide).

Check out the example below to ensure this integration method will work for you.

  • The example showcases an extended Google Analytics ecommerce format.

    <script>
       window.dataLayer = window.dataLayer || [];
       dataLayer.push({
           "transactionId": "sk1006",   // internal order number (up to 100 characters)
           "transactionAction": "1",    // target action code (defined upon integration)
           "transactionProducts": [{
               "sku": "1354471145550",  // internal product code (up to 100 characters)
               "tariff": "2",           // rate code (defined upon integration)
               "price": "300.00",       // product price
               "priceCurrency": "RUB",  // currency code ISO-4217 alfa-3
               "quantity": "2"         // product quantity
           }, {
               "sku": "1354471047246",
               "tariff": "2",
               "price": "500.00",
               "priceCurrency": "USD",
               "quantity": "1"
           }]
       });
    </script>
        

How to deploy a tracking code in GTM

A tracking code consists of two parts. The first is responsible for marking traffic under the Last Paid Click attribution model that Admitad publishers drove to your website. The second part sends order data to the Admitad server.

These parts are placed into two tags:

  • TagTag common contains the first part of the tracking code and is called on all website pages except for the 'Thank you' page.

  • TagTag conversion contains both parts of the tracking code and is deployed on the 'Thank you' page.

To integrate your website using a tracking code using GTM, you need to set up the following:

After that, you can publish the changes.

Setting up triggers

Do the following to set up triggers:

1. On the main page of GTM, in the side menu, select Triggers and click New on the new page.

2. In the upper-right corner, click edit-icon.png and select the trigger type. For that, click DOM Ready in Page View.

dom-ready.jpg

3. Select Some DOM Ready Events.

Define the 'Thank you' page's attribute. For that, specify the following trigger conditions:

  • Page URL
  • contains
  • 'thank_you'. This is a provisional value of the attribute. You can use a custom option.

trigger-conditions.jpg

In the screenshot, the 'thank_you' substring in the URL is the attribute of the 'Thank you' page. Set an appropriate attribute to trigger the trigger on your website's 'Thank you' page.

4. In the upper-left corner of the screen, type the trigger name: TagTag conversion. Save the changes.

5. Create another trigger. In the upper-right corner, click Newedit-icon.pngDOM ReadySome DOM Ready Events.

6. Specify the following trigger conditions: all pages except for the 'Thank you' page:

  • Page URL
  • does not contain
  • 'thank_you'. This is a provisional value of the attribute. You can use a custom option.
    Note: Use the same value you used when setting up TagTag conversion.

trigger-conditions2.jpg

7. In the upper-left corner, specify the trigger name: TagTag common. Save the changes.

You should get the following list of triggers:

  • TagTag common
  • TagTag conversion.

For the sake of convenience, triggers have the same names as the tags for which they're created.

Setting up variables in GTM

Before you start setting the tags, add variables that will send order information.

If you already have variables added, ensure all necessary variables are configured. To do that, go to the list of recommended variables.

To add variables:

1. When on the GTM main page, select Variables in the side menu. On the new page, click New in User-Defined Variables.

2. In the upper-right corner, click edit-icon.png and select the variable type. In Page Variables, select Data Layer Variable.

choose-variable.jpg

3. Add variables depending on your affiliate program category and terms of cooperation.

The number and content of the variables you need to add depend on the data set that should be sent via tracking code.

Below you'll find the recommended sets of variables.

  • Variable in the tracking code Variable function
    ADMITAD.Invoice.category

    Action code.

    Example:

    • Code 1 for an order placed by an existing user.
    • Code 2 for an order placed by a new user.
    positions An order info array including product ID, price, currency, and quantity.
    orderNumber Order number.
  • Variable in the tracking code Variable function
    positions An order info array including product ID, price, currency, and quantity.
    orderNumber Order number.
  • Simplified integration means a one-time setup of sending data via dataLayer with the total amount and order number without any other order details.

    Variable in the tracking code Variable function
    price Order amount.
    orderNumber Order number.
  • Variable in the tracking code Variable function
    orderNumber Order number.
    ADMITAD.Invoice.category (action)

    Action code.

    Example:

    • Code 1 is a loan request from an existing customer.
    • Code 2 is a loan request from a new customer.
    category

    Rate code.

    Example:

    • Code 1 for a request under $100.
    • Code 2 for a request over $100.
  • If your website has a one-time click order form, make sure you have set up everything necessary for a website of this type. Learn more

    Variable in the tracking code Variable function
    price Product price.
    orderNumber Order number.
    productID Product ID.
  • Learn more about these additional tools in this section.

    Variable in the tracking code Variable function
    discountCode A unique promo code applied by the user (for Take&Go promo codes).
    ADMITAD.Invoice.accountId User ID for cross-device tracking. For example, user_id in your system.

To add a variable:

Fill out the following fields on the new page:

  • Data Layer Variable Name (1). Specify a DataLayer variable that will send the value.
  • Data Layer Version (2). Select the Version 2 value.
  • Untitled Variable (3). Set the appropriate DataLayer variable name.

Then click Save.

Add all variables recommended for your program or terms of cooperation.

save-variables.jpg

Setting up tags

To set up TagTag common and TagTag conversion tags:

1. Select Tags in the home page's side menu. Click New on the new page.

2. Specify the tag number TagTag common. In the upper-right corner, in Tag Configuration, click edit-icon.png.

3. Then select the tag type. Click Custom HTML in Custom.

choose-tag.png

4. Paste the code fragment (given below) into the new page.
Pay attention to the comments in the code fragment examples. All comments are added after //.

In the code, replace the {your_campaign_code} value with the campaign_code value. You'll get the following parameter: campaign_code=a1b2c3d4e5, where the highlighted part is the unique number of your affiliate program. Where to get the 'campaign_code' value

  • <script src="https://www.artfut.com/static/tagtag.min.js?campaign_code={your_campaign_code}" async></script>
    <script type="text/javascript">
    // name of the cookie that stores the source
    // change if you have another name
    var cookie_name = 'deduplication_cookie';
    // cookie lifetime
    var days_to_store = 90;
    // expected deduplication_cookie value for Admitad
    var deduplication_cookie_value = 'admitad';
    // name of GET parameter for deduplication
    // change if you have another name
    var channel_name = 'utm_source';
    // a function to get the source from the GET parameter
    getSourceParamFromUri = function () {
      var pattern = channel_name + '=([^&]+)';
      var re = new RegExp(pattern);
      return (re.exec(document.location.search) || [])[1] || '';
    };
    // a function to get the source from the cookie named cookie_name
    getSourceCookie = function () {
      var matches = document.cookie.match(new RegExp(
        '(?:^|; )' + cookie_name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + '=([^;]*)'
      ));
      return matches ? decodeURIComponent(matches[1]) : undefined;
    };
    // a function to set the source in the cookie named cookie_name
    setSourceCookie = function () {
      var param = getSourceParamFromUri();
      var params = (new URL(document.location)).searchParams;
      if (!params.get(channel_name) && params.get('gclid')) { param = 'advAutoMarkup' }
      else if (!params.get(channel_name) && params.get('fbclid')) { param = 'facebook' }
      else if (!param) { return; }
      var period = days_to_store * 60 * 60 * 24 * 1000; // in seconds
      var expiresDate = new Date((period) + +new Date);
      var cookieString = cookie_name + '=' + param + '; path=/; expires=' + expiresDate.toGMTString();
      document.cookie = cookieString;
      document.cookie = cookieString + '; domain=.' + location.host;
    };
    // set cookie
    setSourceCookie();
    </script>
        

5. Click the Triggering block below on the same page and select the TagTag common activation trigger.

choose-trigger.png

 

Click Save.

6. Next, add the second tag. In Tags, click New and specify the name: TagTag conversion.

7. In the Tag Configuration block, in the upper-right corner, click edit-icon.png and select the tag type. Click Custom HTML in Custom.

8. Paste one of the code fragments given below into the new window.

In the code, replace the {your_campaign_code} value with the campaign_code value. You'll get the following parameter: campaign_code=a1b2c3d4e5, where the highlighted part is the unique number of your affiliate program. Where to get the 'campaign_code' value

  • <script src="https://www.artfut.com/static/tagtag.min.js?campaign_code={your_campaign_code}" async></script>
    <script type="text/javascript">
    // name of the cookie that stores the source
    // change if you have another name
    var cookie_name = 'deduplication_cookie';
    // cookie lifetime
    var days_to_store = 90;
    // expected deduplication_cookie value for Admitad
    var deduplication_cookie_value = 'admitad';
    // name of GET parameter for deduplication
    // change if you have another name
    var channel_name = 'utm_source';
    // a function to get the source from the GET parameter
    getSourceParamFromUri = function () {
      var pattern = channel_name + '=([^&]+)';
      var re = new RegExp(pattern);
      return (re.exec(document.location.search) || [])[1] || '';
    };
    // a function to get the source from the cookie named cookie_name
    getSourceCookie = function () {
      var matches = document.cookie.match(new RegExp(
        '(?:^|; )' + cookie_name.replace(/([.$?|{}()[]\\/+^])/g, '\$1') + '=(;)'
      ));
      return matches ? decodeURIComponent(matches[1]) : undefined;
    };
    // a function to set the source in the cookie named cookie_name
    setSourceCookie = function () {
      var param = getSourceParamFromUri();
      var params = (new URL(document.location)).searchParams;
      if (!params.get(channel_name) && params.get('gclid')) { param = 'advAutoMarkup' }
      else if (!param) { return; }
      var period = days_to_store * 60 * 60 * 24 * 1000; // in seconds
      var expiresDate = new Date((period) + +new Date);
      var cookieString = cookie_name + '=' + param + '; path=/; expires=' + expiresDate.toGMTString();
      document.cookie = cookieString;
      document.cookie = cookieString + '; domain=.' + location.host;
    };
    // set cookie
    setSourceCookie();
    </script>
    <script type="text/javascript">
    ADMITAD = window.ADMITAD || {};
    ADMITAD.Invoice = ADMITAD.Invoice || {};
    if (!getSourceCookie(cookie_name)) {
      ADMITAD.Invoice.broker = 'na';
    } else if (getSourceCookie(cookie_name) != deduplication_cookie_value) {
      ADMITAD.Invoice.broker = getSourceCookie(cookie_name);
    } else {
      ADMITAD.Invoice.broker = 'adm';
    }
    ADMITAD.Invoice.category = '{{category}}'; // place to set the variable transactionAction
    var orderedItem = [];
    
    var positions = {{transactionProducts}}; // place to set the variable transactionProducts
    
    for (i = 0; i < positions.length; ++i) {
    orderedItem.push({
    Product: {
    productID: positions[i]['sku'],
    category: positions[i]['tariff'],
    price: positions[i]['price'],
    priceCurrency: positions[i]['priceCurrency']
    }, orderQuantity: positions[i]['quantity'],
    additionalType: "sale"
    });
    } ADMITAD.Invoice.referencesOrder = ADMITAD.Invoice.referencesOrder || [];
    ADMITAD.Invoice.referencesOrder.push({
    orderNumber: '{{orderNumber}}', // place to set the variable transactionId
    // uncomment the next string if you provide Take&Go promo codes to publishers
    // discountCode: "{{promocode}}"
    orderedItem: orderedItem }); // Important! If you send data via AJAX or through the one-click order form, uncomment the last string:
    // ADMITAD.Tracking.processPositions();
    </script>
  • Use the example above by setting the action code as a constant:

    <script src="https://www.artfut.com/static/tagtag.min.js?campaign_code={your_campaign_code}" async></script>
    <script type="text/javascript">
    // name of the cookie that stores the source
    // change if you have another name
    var cookie_name = 'deduplication_cookie';
    // cookie lifetime
    var days_to_store = 90;
    // expected deduplication_cookie value for Admitad
    var deduplication_cookie_value = 'admitad';
    // name of GET parameter for deduplication
    // change if you have another name
    var channel_name = 'utm_source';
    // a function to get the source from the GET parameter
    getSourceParamFromUri = function () {
      var pattern = channel_name + '=([^&]+)';
      var re = new RegExp(pattern);
      return (re.exec(document.location.search) || [])[1] || '';
    };
    // a function to get the source from the cookie named cookie_name
    getSourceCookie = function () {
    var matches = document.cookie.match(new RegExp(
    '(?:^|; )' + cookie_name.replace(/([.$?|{}()[]\\/+^])/g, '\$1') + '=(;)' ));
    return matches ? decodeURIComponent(matches[1]) : undefined;
    };
    // a function to set the source in the cookie named cookie_name
    setSourceCookie = function () {
    var param = getSourceParamFromUri();
    var params = (new URL(document.location)).searchParams;
    if (!params.get(channel_name) && params.get('gclid')) { param = 'advAutoMarkup' }
    else if (!param) { return; }
    var period = days_to_store * 60 * 60 * 24 * 1000; // in seconds
    var expiresDate = new Date((period) + +new Date);
    var cookieString = cookie_name + '=' + param + '; path=/; expires=' + expiresDate.toGMTString();
    document.cookie = cookieString;
    document.cookie = cookieString + '; domain=.' + location.host;
    };
    // set cookie
    setSourceCookie();
    </script>
    <script type="text/javascript"> ADMITAD = window.ADMITAD || {};
    ADMITAD.Invoice = ADMITAD.Invoice || {};
    if (!getSourceCookie(cookie_name)) {
    ADMITAD.Invoice.broker = 'na'; } else if (getSourceCookie(cookie_name) != deduplication_cookie_value) {
    ADMITAD.Invoice.broker = getSourceCookie(cookie_name);
    } else {
    ADMITAD.Invoice.broker = 'adm';
    }
    ADMITAD.Invoice.category = '1';
    var orderedItem = [];
    var positions = {{transactionProducts}}; // place to set the variable transactionProducts
    for (i = 0; i < positions.length; ++i) {
    orderedItem.push({
    Product: {
    productID: positions[i]['sku'],
    category: positions[i]['tariff'],
    price: positions[i]['price'],
    priceCurrency: positions[i]['priceCurrency']
    }, orderQuantity: positions[i]['quantity'],
    additionalType: "sale"
    });
    }
    ADMITAD.Invoice.referencesOrder = ADMITAD.Invoice.referencesOrder || [];
    ADMITAD.Invoice.referencesOrder.push({
    orderNumber: '{{orderNumber}}', // place to set the variable transactionId
    // uncomment the next string if you provide Take&Go promo codes to publishers
    // discountCode: "{{promocode}}"
    orderedItem: orderedItem
    });
    // Important! If you send data via AJAX or through the one-click order form, uncomment the last string:
    // ADMITAD.Tracking.processPositions();
    </script>
  • <script src="https://www.artfut.com/static/tagtag.min.js?campaign_code={your_campaign_code}" async></script>
    <script type="text/javascript">
    // name of the cookie that stores the source
    // change if you have another name
    var cookie_name = 'deduplication_cookie';
    // cookie lifetime
    var days_to_store = 90;
    // expected deduplication_cookie value for Admitad
    var deduplication_cookie_value = 'admitad';
    // name of GET parameter for deduplication
    // change if you have another name
    var channel_name = 'utm_source';
    // a function to get the source from the GET parameter
    getSourceParamFromUri = function () {
      var pattern = channel_name + '=([^&]+)';
      var re = new RegExp(pattern);
      return (re.exec(document.location.search) || [])[1] || '';
    };
    
    // a function to get the source from the cookie named cookie_name
    getSourceCookie = function () {
    var matches = document.cookie.match(new RegExp(
    '(?:^|; )' + cookie_name.replace(/([.$?|{}()[]\\/+^])/g, '\$1') + '=(;)' ));
    return matches ? decodeURIComponent(matches[1]) : undefined;
    };
    // a function to set the source in the cookie named cookie_name
    setSourceCookie = function () {
    var param = getSourceParamFromUri();
    var params = (new URL(document.location)).searchParams;
    if (!params.get(channel_name) && params.get('gclid')) { param = 'advAutoMarkup' }
    else if (!param) { return; }
    var period = days_to_store * 60 * 60 * 24 * 1000; // in seconds
    var expiresDate = new Date((period) + +new Date);
    var cookieString = cookie_name + '=' + param + '; path=/; expires=' + expiresDate.toGMTString();
    document.cookie = cookieString;
    document.cookie = cookieString + '; domain=.' + location.host; };
    // set cookie
    setSourceCookie();
    </script>
    <script type="text/javascript"> ADMITAD = window.ADMITAD || {};
    ADMITAD.Invoice = ADMITAD.Invoice || {};
    if (!getSourceCookie(cookie_name)) {
    ADMITAD.Invoice.broker = 'na'; } else if (getSourceCookie(cookie_name) != deduplication_cookie_value) {
    ADMITAD.Invoice.broker = getSourceCookie(cookie_name);
    } else {
    ADMITAD.Invoice.broker = 'adm';
    }
    ADMITAD.Invoice.category = '1'; // place to set the variable transactionAction
    var orderedItem = []; // temporary array for product items // repeat for each item in the cart
    orderedItem.push({
    Product: {
    productID: '1', // internal item code (up to 100 characters, matches the ID from the product feed)
    category: '1', price: '{{price}}', // item price (if there is a discount, this is a discounted price)
    priceCurrency: 'USD', // currency code per ISO-4217 alpha-3
    },
    orderQuantity: '1', // quantity
    additionalType: 'sale' // always sale }); ADMITAD.Invoice.referencesOrder = ADMITAD.Invoice.referencesOrder || [];
    // adding more items
    ADMITAD.Invoice.referencesOrder.push({
    orderNumber: '{{order number}}', // order ID from your CMS (up to 100 characters) // discountCode: '{{promocode}}', // promo code; this parameter is required if you provide Take&Go promo codes to publishers
    orderedItem: orderedItem }); // Important! If you send data via AJAX or through the one-click order form, uncomment the last string:
    // ADMITAD.Tracking.processPositions(); </script>
  • <script src="https://www.artfut.com/static/tagtag.min.js?campaign_code={your_campaign_code}" async></script>
    <script type="text/javascript">
    // name of the cookie that stores the source
    // change if you have another name
    var cookie_name = 'deduplication_cookie';
    // cookie lifetime
    var days_to_store = 90;
    // expected deduplication_cookie value for Admitad
    var deduplication_cookie_value = 'admitad';
    // name of GET parameter for deduplication
    // change if you have another name
    var channel_name = 'utm_source';
    // a function to get the source from the GET parameter
    getSourceParamFromUri = function () {
      var pattern = channel_name + '=([^&]+)';
      var re = new RegExp(pattern);
      return (re.exec(document.location.search) || [])[1] || '';
    };
    
    // a function to get the source from the cookie named cookie_name
    getSourceCookie = function () {
    var matches = document.cookie.match(new RegExp(
    '(?:^|; )' + cookie_name.replace(/([.$?|{}()[]\\/+^])/g, '\$1') + '=(;)' ));
    return matches ? decodeURIComponent(matches[1]) : undefined;
    };
    // a function to set the source in the cookie named cookie_name
    setSourceCookie = function () {
    var param = getSourceParamFromUri();
    var params = (new URL(document.location)).searchParams;
    if (!params.get(channel_name) && params.get('gclid')) { param = 'advAutoMarkup' }
    else if (!param) { return; }
    var period = days_to_store * 60 * 60 * 24 * 1000; // in seconds
    var expiresDate = new Date((period) + +new Date);
    var cookieString = cookie_name + '=' + param + '; path=/; expires=' + expiresDate.toGMTString();
    document.cookie = cookieString;
    document.cookie = cookieString + '; domain=.' + location.host; };
    // set cookie
    setSourceCookie();
    </script>
    <script type="text/javascript"> ADMITAD = window.ADMITAD || {};
    ADMITAD.Invoice = ADMITAD.Invoice || {};
    if (!getSourceCookie(cookie_name)) {
    ADMITAD.Invoice.broker = 'na'; } else if (getSourceCookie(cookie_name) != deduplication_cookie_value) {
    ADMITAD.Invoice.broker = getSourceCookie(cookie_name);
    } else {
    ADMITAD.Invoice.broker = 'adm';
    }
    ADMITAD.Invoice.category = '1'; var orderedItem = []; // temporary array for product items
    // repeat for each item in the cart
    orderedItem.push({
    Product: {
    category:'1',
    price: '1',
    priceCurrency: 'USD', // currency code per ISO-4217 alpha-3
    },
    orderQuantity: '1',
    additionalType: 'sale' // always sale
    }); ADMITAD.Invoice.referencesOrder = ADMITAD.Invoice.referencesOrder || [];
    // adding more items
    ADMITAD.Invoice.referencesOrder.push({
    orderNumber: '{{order number}}', // order ID from your CMS (up to 100 characters) // discountCode: '{{promocode}}', // promo code; this parameter is required if you provide Take&Go promo codes to publishers
    orderedItem: orderedItem }); // Important! If you send data via AJAX or through the one-click order form, uncomment the last string:
    // ADMITAD.Tracking.processPositions(); </script>

9. Replace the variables from the template with the corresponding variables from the Variables section (side menu in the GTM account interface).

To do that, specify the variables you used in your code version for the variables from the tracking code.

Example: orderNumber:{{name of your variable in GTM}}.

10. Save the changes.

save-tag.png

 

How to: Additional settings

If you don't need additional settings and tools, jump to the next step.

Alongside the standard settings, you can add the following ones:

Tracking settings for a website with a one-click order form

If your website has a one-click order form, you must set up tracking for such orders.

1. Set up the event in GTM dataLayer following this guide. This parameter should include the following:

  • Information about the product on whose page the order is placed
  • Unique order number

See an example of the code below. The structure of your dataLayer may be different.

  • window.dataLayer = window.dataLayer || [];
    window.dataLayer.push({
      "event": "orderPlaced",
      "price": productPrice,
      "id": "productId",
      "orderId": orderNumber
    });
        

2. Set a trigger that will be called upon the 'One-click order' event. Specify the following trigger conditions:

  • Event
  • equals
  • orderPlaced. This is a provisional value of the attribute. You can use a custom option.

trigger-1click.png

After that, in the upper-left corner, add the name 1click conversion and save the changes.

3. Add the following variables to GTM that will send order info from dataLayer.

Variable in the tracking code Variable function
price Product price.
orderNumber Order number.
productID Product ID.
  • Add all the variables one by one:

    3.1 Go to the Variables section. In the upper-right corner, click New in the User-Defined Variables block.

    3.1 In the upper-right corner of the new page, click edit-icon.png.

    3.3 In the Page Variables block, select the Data Layer Variable variable.

    3.4 On the new page, fill out the following fields:

    • Data Layer Variable Name. Enter 1cItemPrice.
    • Data Layer Version. Ensure the Version 2 value is selected.

    Next, specify the name of the price variable and save the changes.

    Next, add the remaining two variables using appropriate data.

    1click.png

4. Add the 1click conversion tag and the Custom HTML tag type.

  • 4.1 Select Tags in the home page's side menu. Click New on the new page.

    4.2 Specify the tag name 1click conversion. In the upper-right corner, in the Tag Configuration block, click edit-icon.png.

    4.3 Next, select the tag type. Click Custom HTML in Custom.

    Paste the code (given below) into the new window.

    <script type="text/javascript">
    ADMITAD = window.ADMITAD || {};
    ADMITAD.Invoice = ADMITAD.Invoice || {};
    if (!getSourceCookie(cookie_name)) {
      ADMITAD.Invoice.broker = 'na';
    } else if (getSourceCookie(cookie_name) != deduplication_cookie_value) {
      ADMITAD.Invoice.broker = getSourceCookie(cookie_name);
    } else {
      ADMITAD.Invoice.broker = 'adm';
    } // identification of the paid traffic source if deduplication is set
    ADMITAD.Invoice.category = '1';
    
    var orderedItem = []; // temporary array for product items orderedItem.push({
    Product: {
    productID: '{{1cProductId}}', // internal item code (up to 100 characters, matches the ID from the product feed)
    category: '1', // target action rate code
    price: '{{1cItemPrice}}', // item price (if there is a discount, this is a discounted price)
    priceCurrency: 'USD', // currency code per ISO-4217 alpha-3
    },
    orderQuantity: '1', // quantity
    additionalType: 'sale' // always sale });
    ADMITAD.Invoice.referencesOrder = ADMITAD.Invoice.referencesOrder || [];
    ADMITAD.Invoice.referencesOrder.push({
    orderNumber: '{{1cOrderNumber}}', // order ID from your CMS (up to 100 characters)
    orderedItem: orderedItem }); ADMITAD.Tracking.processPositions();
    </script>

5. Set an appropriate trigger for this tag. Click the Triggering block below on the same page and select the 1click conversion activation trigger.

Save the changes.

save-1click.png

Done! A tracking code for one-time click orders has been added to the container on your website.

Setting up sending Take&Go promo codes

Take&Go promo codes are promo codes that contain a unique keyword used to track target actions. Such promo codes are assigned to specific publishers. Learn more about Take&Go promo codes


To use Take&Go promo codes:

1. Add a new variable, promocode, and link it to the transactionPromocode data layer variable.

  • 1.1 Go to the Variables section. In the upper-right corner, click New in the User-Defined Variables block.

    1.2 In the upper-right corner of the new page, click edit-icon.png.

    1.3 In the Page Variables block, select the Data Layer Variable variable.

    1.4 On the new page, fill out the following fields:

    • Data Layer Variable Name. Enter transactionPromocode.
    • Data Layer Version. Ensure the Version 2 value is selected.

    Next, specify the name of the promocode variable and save the changes.

    variable-promocode.png

2. Select Tags in the side menu and add the set variable to the conversion tag.

For that, click TagTag conversion and update the code in the new configuration window.

  • // adding items to the order
    ADMITAD.Invoice.referencesOrder.push({
      orderNumber: "{{orderNumber}}", // internal order number (up to 100 characters)
    //  discountCode: "{{promocode}}",  //  unique promo code code
      orderedItem: orderedItem

Save the changes.

Done! A tracking code for Take&Go promo code orders has been added to the container on your website.

Test the code you've added to make sure orders are being tracked correctly.

Setting up sending user ID during cross-device tracking

Cross-device tracking allows you to monitor a user's target actions on various devices. Learn more


Cross-device tracking is set up by default.

When a user visits an advertiser's website, Admitad puts together a unique, anonymous profile. If a user performs a target action, Admitad collates the profile data and registers a target action if admitad_uid is present.

You can send the user ID in the dataLayer object. This unique identifier ensures that the target action will be registered correctly, even if the user follows the affiliate link on one device and performs a target action on another.

The following can be a unique identifier:

  • User email
  • Or the username of the user registered on your website.

A user's identifier has a higher priority than an anonymous profile. If the tracking code contains accountId, the request you send will include the user's identifier rather than the details of the anonymous profile.

To receive this information, do the following:

1. Send the user ID to the dataLayer object.

  •   dataLayer.push({
           "transactionCustomer": "customer@email.com";     // user email
           });

Admitad doesn't store the value of this parameter, nor does it send it publicly.


2. Add a new variable, accountID, and link it to the transactionCustomer data layer variable.

  • 2.1 Go to the Variables section. In the upper-right corner, click New in the User-Defined Variables block.

    2.2 In the upper-right corner of the new page, click edit-icon.png.

    2.3 In the Page Variables block, select the Data Layer Variable variable.

    2.4 On the new page, fill out the following fields:

    • Data Layer Variable Name. Enter transactionCustomer.
    • Data Layer Version. Ensure the Version 2 value is selected.

    Next, specify the name of the accountId variable and save the changes.

    account-id.png

3. Go to Tags and click TagTag conversion to open the tag configuration window. Between the lines with parameters ADMITAD.Invoice.broker and ADMITAD.Invoice.category add the following line:

ADMITAD.Invoice.accountId = '{{accountId}}';    // place of the variable

Save the changes.

4. Click TagTag common to open the tag configuration window. Add the following line to the new configuration window:

ADMITAD.Invoice.accountId = '{{accountId}}';    // place of the variable


Save the changes.

Done! A tracking code for sending unique user parameters has been added to the container on your website.

How to publish changes

After setting up triggers, variables, and tags, you need to save the tracking code version and publish changes in GTM.

To do that:

1. In the upper-right corner of the main page, click Submit.

2. Specify the name of the tracking code version, add a comment (if necessary), and click Publish.

Done! Tracking code integration via GTM is now complete.

All changes will be published in a special container on your website, and you'll be able to track the target actions of users.

publish.png

 

How to test integration after setup

To test sending Take&Go promo codes, go to this section.

1. Copy the test link from the personal account. How to find the test link

2. Follow the test link to your website. Check if the address bar contains all required GET parameters and UTM tags.

3. Perform a target action on the website (e.g., purchase a product).

4. Go to your Admitad account → Reports → By actions. Check that the report correctly shows the target action and its data:

  • The target action name in the Rate column in the report matches the name of this target action in the Actions section.
  • The action ID in the Order ID column matches the action ID in your system.
  • The order amount in Admitad corresponds to the test order amount.

5. Make sure you can find the test order in your CMS by the orderNumber value. This value will be used for verification later.

If your program uses several target actions and rates, test each.

If everything is successful, your test is complete. Congrats!

If you face any problems during testing, go to this section.

6. Let an Admitad manager know when your test is over. They'll prepare your program for launch.

How to test integration after setting up sending Take&Go promo codes

1. Make sure the Take&Go promo code is added to the system.Learn more

2. Clear browser cookies and place an order through the direct link using the promo code added to the system.

3. Go to your Admitad account → Reports → By actions. Check that the report correctly shows the target action and its data:

  • The target action name in the Rate column in the report matches the name of this target action in the Actions section.
  • The action ID in the Order ID column matches the action ID in your system.
  • The order amount in Admitad corresponds to the test order amount.

5. Make sure you can find the test order in your CMS by the orderNumber value. This value will be used for verification later.

If your program uses several target actions and rates, test each.

If everything is successful, your test is complete. Congrats!

If you face any problems during testing, go to this section.

6. Let an Admitad manager know when your test is over. They'll prepare your program for launch.

Problems that can arise during testing

If the target action hasn't appeared in the statistics, you might have made a mistake while placing or setting up the tracking code.

Problem Solution
A tracking code isn't working. There are no requests in the browser's Network tab.

The script is connected incorrectly.

Follow the instructions given in the Tracking code integration using Google Tag Manager section.

The script doesn't work. There are errors in the browser console.

Follow the instructions given in the Tracking code integration using Google Tag Manager section.

Check JavaScript syntax in TagTag common and TagTag conversion tags.

The script works. There are no errors in the browser console.

The action doesn't appear in the reports.

The campaign_code parameter has an invalid value or is missing.
Check the campaign_code value and, if necessary, replace it in the code (see this guide).

The script works. There are no errors in the browser console.

The value of the campaign_code parameter is correct. The order hasn't appeared in the reports.

To identify the error, go to the request log (Program → Integration → Integration test). You'll find the error text in the Result field.

Fix the error and run another test.

The script works. There are no errors in the browser console.

The value of the campaign_code parameter is correct. There are no errors in the Request log. The action doesn't appear in the reports.

There are temporary technical restrictions (log delay) on Admitad's side. Check back in an hour.

The script works. There are no errors in the browser console.

The value of the campaign_code parameter is correct. There are no errors in the Request log. The action hasn't appeared in the reports after an hour.

Ask an Admitad specialist for help.

FAQ

Where do I find the 'campaign_code' value?

1. In your account, go to the Integration section (Program → Integration).

2. Click Next and, on the Integration methods page, open the Custom integration) tab.

3. In the Custom integration tab, select Tracking code GTM and click Next.

4. Find the campaign_code value in the table located at the top of the screen (Integration setup: unique parameter values for your program).

1. In your account, go to the Integration section (Program → Integration).

2. Click Next and, on the Integration methods page, open the Custom integration) tab.

3. In the Custom integration tab, select Tracking code GTM and click Next.

4. The Integration testing section is located at the bottom of the screen.

Czy ten artykuł był pomocny?