Tag Events

Overview

In general, adding page specific parameters requires you to push the parameters to the CUBED Attribution request using the general syntax:

vscr.push([ `command_name`, `values` ] );

The Cubed tag supports firing Events - this is the most common usage. You can add details to an event, along with further data such as discount codes and shipping details.

The Cubed tag also supports "Labels". This allows you to add extra meta data to any tag fire, at any level. This can be used to say "This visit is logged in", or "this Event is category X".
See how to fire labels.

Please view Currency Codes for information on our accepted codes. If there is a currency missing please contact us. Our system defaults to GBP where blank.

Firing Events

The most used page-specific parameter is 'addEvent', which allows you to capture events for use within the CUBED Attribution interface. Please note that these events must have been preconfigured in the CUBED Attribution interface before they can be captured. An event must have a Name, but it can have optional supplementary data including: Revenue, Transaciton Id, and Currency.

You can also add Details to a single Event, enrching it with specific data such as Product SKU etc..: Firing Events With Details

When firing an Event, you can also attach extra, optional, meta data such Discount Details or even Shipping Details

Event Name - Mandatory

The most basic syntax for addEvent is as follows, and must be included in order for an event to be captured:

vscr.push(["addEvent", {name: "Event Name" }])

In here, you would change "Event Name" to the name of the event that you wish to fire.

You are also able to capture further information about the event; as well as the event name itself, you can also capture revenue, transaction ID, and specific item details.

You can name events anything you like, but they must be set up in the CUBED Attribution interface with names that match exactly before you begin capturing data. An event can be applied to multiple products, and a product must have a sale event defined in the CUBED Attribution interface.

Revenue - Optional

This parameter is optional, and is used to capture the revenue attached to an event.

vscr.push(["addEvent", {name: "Event Name", revenue: "1500"}])

If used, you must provide a valid number with an optional two decimal places. This value can be either a number or a string. You must remove all commas and currency symbols before pushing the event.

Examples:

  • 105
  • 105.35
  • "105.35"

Transaction ID - Optional

This parameter is used to capture a unique transaction ID for any event.

vscr.push(["addEvent", 
    {
        name: "Event Name", 
        revenue: "1500", 
        transactionId: "abcdef123"
    }
]);

Wherever possible, a transaction ID should be passed up, and must be passed up as a string.

Examples:

  • "abcde1000e"
  • "ABC-1000-E"
  • "123456"

Currency - Optional

This parameter is used to capture the currency type for the event's revenue value. Must be a string.

vscr.push(["addEvent", 
    {
        name: "Event Name", 
        revenue: "1500", 
        transactionId: "abcdef123", 
        currency: 'EUR'
    }
]);

Firing Events With Details

Item Details - Optional

If you wish to capture the details of a particular item when firing the event, you will need to use the details parameter. This is an array of objects, where each object is a particular item.

You are able to pass up the following parameters for each object:

Of the parameters above, only Name is mandatory.

The script to capture details with an event is as follows:

vscr.push(["addEvent", {
        name:"Event Name",
        revenue: "Revenue",
        transactionId: "Transaction ID",
        details:[{
            name: "Item1 Name",
            sku: "Item1 SKU",
            quantity: "10",
            cost: "100.50",
            currency: "USD"
        }]  
    }
])

Also with multiple details:

vscr.push(["addEvent", {
    name:"Event Name",
    revenue: "Revenue",
    transactionId: "Transaction ID",
    details: [{
            name: "Item1 Name",
            sku: "Item1 SKU",
            quantity: "10",
            cost: "100.50",
            currency: "EUR"
        },
        {
            name: "Item2 Name",
            sku: "Item2 SKU",
            quantity: "5",
            cost: "600.00",
            currency: "EUR"
        }]
    }
])

Both name and SKU must be captured as a string; quantity and cost can be captured as either string or number, but as with revenue, all commas and currency symbols must be removed before pushing the event.

Please see the Currency Codes for information on our accepted codes.


Discount Details

Optional details

If you wish to capture the discount codes when firing an event, you will need to use the discounts parameter. This is an array of objects, where each object is a particular discount item.

You are able to pass up the following parameters for each object:

  • Name
  • Code
  • Price
  • Currency

Of the parameters above, only Name is mandatory.
Code defaults to a blank string ''.
Price defaults to 0.0.
Currency defaults to 'GBP'.

The script to capture an event with discount details:

vscr.push(["addEvent", {
        name:"Event Name",
        revenue: "Revenue",
        transactionId: "Transaction ID",
        discounts:[{
            name: "My Discount Code",
            code: "discount-10ABC",
            price: -10,
            currency: "GBP"
        }]  
    }
])

Also with multiple details:

vscr.push(["addEvent", {
    name:"Event Name",
    revenue: "Revenue",
    transactionId: "Transaction ID",
    discounts: [{
            name: "My Discount Code",
            code: "discount-10ABC",
            price: -100,
            currency: "GBP"
        },
        {
            name: "Another Voucher Code",
            code: "2015-voucher-123",
            price: -10.50,
        }]
    }
])

Both name and code must be captured as a string; price can be captured as either string or number, but as with revenue, all commas and currency symbols must be removed before pushing the event with discounts.

Please see the Currency Codes for information on our accepted codes.


Shipping Details

Optional details

If you wish to capture the shipping details for an event, you will need to use the shippings parameter. This is an array of objects, where each object is a particular shipping item detail.

You are able to pass up the following parameters for each object:

  • Name
  • Code
  • Price
  • Currency

Of the parameters above, only Name is mandatory.
Code defaults to a blank string ''.
Price defaults to 0.0.
Currency defaults to 'GBP'.

The script to capture an event with shipping details:

vscr.push(["addEvent", {
        name:"Event Name",
        revenue: "Revenue",
        transactionId: "Transaction ID",
        shippings:[{
            name: "Shipping Global",
            code: "shipping-2000",
            price: 30,
            currency: "GBP"
        }]  
    }
])

Also with multiple details:

vscr.push(["addEvent", {
    name:"Event Name",
    revenue: "Revenue",
    transactionId: "Transaction ID",
    shippings: [{
            name: "Shipping Global",
            code: "shipping-2000",
            price: 30,
            currency: "GBP"
        },
        {
            name: "Shipping Extra",
            code: "extra-2018",
            price: 15.50,
        }]
    }
])

Both name and code must be captured as a string; price can be captured as either string or number, but as with revenue, all commas and currency symbols must be removed before pushing the event with discounts.

Please see the Currency Codes for information on our accepted codes.