Spektrix Data Layer
A Spektrix confirmation Iframe has a data layer that holds information on all of the items in a purchase. As we are currently supporting both the Universal Analytics and Google Analytics 4 versions, the data layer contains data that are compatible for each of these.
Example Data Layer
[
{
"transactionId": "22-JZ-03GS",
"transactionTotal": 37,
"transactionShipping": 0,
"transactionCity": "Edinburgh",
"transactionState": "Midlothian",
"transactionCountry": "United Kingdom",
"transactionProducts": [{
"sku": "T82811-20P400",
"name": "Aladdin",
"category": "Tickets",
"price": 4,
"quantity": 2
},
{
"sku": "M14810-P200",
"name": "A birthday present",
"category": "Merchandise",
"price": 2,
"quantity": 1
},
{
"sku": "D7808",
"name": "Donation to Xmas Fund",
"category": "Donations",
"price": 10,
"quantity": 1
},
{
"sku": "G",
"name": "Gift Vouchers",
"category": "Gift Vouchers",
"price": 10,
"quantity": 1
},
{
"sku": "F-TicketDelivery",
"name": "Ticket Delivery Fee",
"category": "Fees",
"price": 1.5,
"quantity": 1
},
{
"sku": "F-MerchandiseDelivery",
"name": "Merchandise Delivery Fee",
"category": "Fees",
"price": 2.5,
"quantity": 1
},
{
"sku": "F-Transaction",
"name": "Transaction Fee",
"category": "Fees",
"price": 3,
"quantity": 1
}
],
"ecommerce": {
"transaction_id": "22-JZ-03GS",
"value": 37,
"shipping": 4,
"items": [{
"item_id": "T82811I872-20P400-O4",
"item_name": "Aladdin",
"item_category": "Tickets",
"item_category2": "Standard",
"item_category3": "Child",
"item_variant": "16 September 2022",
"price": 4,
"quantity": 2,
"coupon": "20% off Everything",
"discount": 1
},
{
"item_id": "S69-98P10500",
"item_name": "Season Pass 2022",
"item_category": "Ticket Subscription",
"item_category2": "Adult Premium",
"price": 105,
"quantity": 1,
"discount": 0
},
{
"item_id": "M14810-P200",
"item_name": "A birthday present",
"item_category": "Merchandise",
"price": 2,
"quantity": 1,
"discount": 0
},
{
"item_id": "D7808",
"item_name": "Donation to Xmas Fund",
"item_category": "Donations",
"price": 10,
"quantity": 1,
"discount": 0
},
{
"item_id": "G",
"item_name": "Gift Vouchers",
"item_category": "Gift Vouchers",
"price": 10,
"quantity": 1,
"discount": 0
},
{
"item_id": "F-TicketDelivery",
"item_name": "Ticket Delivery Fee",
"item_category": "Fees",
"price": 1.5,
"quantity": 1,
"discount": 0
},
{
"item_id": "F-MerchandiseDelivery",
"item_name": "Merchandise Delivery Fee",
"item_category": "Fees",
"price": 2.5,
"quantity": 1,
"discount": 0
},
{
"item_id": "F-Transaction",
"item_name": "Transaction Fee",
"item_category": "Fees",
"price": 3,
"quantity": 1,
"discount": 0
}
]
},
"event": "Spektrix Transaction"
}
]
Breakdown of the Data Layer
Transaction variables
In the example above you can see a number of transaction variables. Here’s how they break down:
Universal Analytics | Google Analytics 4 | Description |
---|---|---|
transactionId | transaction_id | The Spektrix order id |
transactionTotal | value | The total value of the transaction |
transactionProducts | items | This is an array containing several values, which repeats for each item purchased |
transactionShipping | shipping | This is the total delivery amount |
transactionProducts / items
Within transactionProducts (Universal Analytics) / items (Google Analytics 4) are the following:
Universal Analytics | Google Analytics 4 | Description |
---|---|---|
sku | item_id | A unique ID for each product (see details below) |
name | item_name | The name of the product i.e. the name of the event or merch item |
price | price | The total price for that item in the order |
quantity | quantity | The total number of that item in the order |
category | item_category | The type of product i.e. Tickets, Fees, Memberships, etc |
item_category2 | The price band name for tickets or the pricing set name for ticket subscriptions | |
item_category3 | The ticket type name | |
item_variant | The instance date | |
coupon | The name of the offer or the ticket subscription applied, if applicable | |
discount | The total discount amount for the item if an offer is applied |
sku / item_id
The sku/item_id is worth looking at separately - it’s a unique code for each item in the transactionProducts/items array, which can be used for identifying each item in triggers.
Here’s an example of a sku (Universal Analytics only): T8601-1412P4500. This breaks down as follows:
- T represents a Ticket.
- 8601 represents Event ID 8601.
- 1412 represents Ticket Type 1412 (which in this case is Adult).
- P4500 represents a Price of £45.00 (or $45.00 depending on your currency).
Here’s an example of an item_id (GA4 only): T8601I872-1412P4500. This breaks down as follows:
- T represents a Ticket.
- 8601 represents Event ID 8601.
- I872 represents Instance ID 872
- 1412 represents Ticket Type 1412 (which in this case is Adult).
- P4500 represents a Price of £45.00 (or $45.00 depending on your currency).
When an offer is applied to a ticket the item_id will include the offer id prefixed with “O” as per this example T8601I872-1412P4500-O4.
Here’s another example of an item_id (GA4 only): S326-726P13000. This breaks down as follows:
- S represents a subscription for a Ticket Subscription.
- 326 represents Ticket Subscription ID 326.
- 726 represents Pricing Set 726 (which in this case is Adult Premium).
- P13000 represents a Price of £130.00 (or $45.00 depending on your currency).
Other sku/item_id examples might be:
- M1-P500: a Merchandise item for Stock Item ID 1 costing £5 (or $5).
- S1-New: a new Subscription for Membership ID 1.
- S1-Renewal: a renewal for Membership ID 1
- D1: a donation to Fund ID 1.
You can find the Spektrix IDs for your Events, Merchandise etc in the API feed, or alternatively by contacting the Spektrix Support team.
This information can be imported in Google Analytics, or other platforms such as Facebook, to track the performance of the website and advertising campaigns. We will look at how it is imported with Google Tag Manager.