Variables (JavaScript)

Toma
Toma
  • Updated

With Adform custom variables you can pass additional information such as sales, order IDs, product names, or other custom values via the tracking point together with information collected by default (such as browser type, operating system, or screen size).

The data is sent to Adform servers and later can be used for retargeting or analytics purposes.

Order and Product Level Variables

Variables can be passed either on order (single value) or product (multiple value) levels.

Order Level

Order level variables are used for values unique per each activation and are used when a single value needs to be passed at a time, such as the order ID or total sales amount of a purchase made. Such variables are defined in the scope of order object:

window.adf&&adf.ClickTrack(this,{trackingID},'Example tracking point',{sales:'insert sales value here',orderid:'insert order id value here',currency:'insert currency value here'});

Product Level

Product level variables are used to pass information about each individual item, such as product cart details. These variables are defined in the itms array, which is added to the order object.

If there are several items which need to be passed, that can be done by creating an additional item in the array:

itms: [{
    productname: '<insert product 1 name value here>',
    productid: '<insert product 1 id value here>',
    productsales: '<insert product 1 sales value here>',
},{
    productname: '<insert product 2 name value here>',
    productid: '<insert product 2 id value here>',
    productsales: '<insert product 2 sales value here>',
},{
    productname: '<insert product 3 name value here>',
    productid: '<insert product 3 id value here>',
    productsales: '<insert product 3 sales value here>',
}]

Custom Variables

Variables in Adform come with predefined names (such as Sales, Order ID) and also custom ones, which can be renamed in Adform platform.

These variables can pass values at the order or product level:

  • svn1 and svn2: used to pass a real number (integer) only, which can be later used to create custom reports.

  • sv(x): can pass any kind of string, and they can vary up to var10. These variables can only be used at the order level.

  • var(x): (such as var1, var2) can pass any kind of string, and they can vary up to var10. These variables can only be used at the order level.

Supported variables:

Name

JS variable name

Used in

Value

Decoded parameter name

Report type

Order level variables

Sales

sales

Order

Real

sl

Custom reports

Order ID

orderid

Order

String

id

Data exports

Currency

currency

Order

String

cur

Custom reports

Basket Size

basketsize

Order

String

bsz

Custom reports

Gender

gender

Order

String

gen

Custom reports

Age group

agegroup

Order

String

age

Custom reports

Country

country

Order

String

cntr

Custom reports

Product level variables

Product name

productname

Product

String

pnm

Custom reports

Product sales

productsales

Product

Real

psl

Custom reports

Product ID

productid

Product

String

pid

Custom reports

Product category

categoryname

Product

String

pgr

Custom reports

Product category ID(DCO)

categoryid

Product

String

cid

N/A

Product count

productcount

Product

Integer

pcnt

Custom reports

Weight (DCO weight in rotation)

weight

Product

Integer

weight

N/A

Step (DCO view, basket or purchase event)

step

Product

Integer

step

N/A

Custom variables

var1 … var10

var1var10

Order

String

var1var10

Data exports

sv1 … sv7

sv1sv7

Both

String

sv1sv7

Custom reports

sv8 … sv96

sv8sv96

Both

String

sv8sv96

Data exports

svn1 and svn2

svn1 and svn2

Both

Real

svn1 and svn2

Custom reports

sv97... sv255

sv97... sv255

Both

String

sv97... sv255

DMP

svn3... svn255

svn3... svn255

Both

Real

svn3... svn255

DMP

Check Implementation

After implementing the tracking point on a page, you can check if it was activated using Adform site tracking testing browser extension. You can download it for a Chrome browser from the web store.

Alternatively, you can check network requests via the browser’s developer tools:

Redirect

Successful activation will result in a tracking point network request, which contains the tracking setup ID, tracking point name, and other information sent.

Javascript variables are encoded in Base 64 function before sending the tracking point request to Adform servers where the data is decoded.

For additional information, contact the Site Tracking team (site-tracking@adform.com).

Was this article helpful?

/
How we can make it better?

Thank you for your feedback!