Dev Request: Dev Request - Purchase

Status: In Dev Queue
Last updated: November 22, 2022 5:04 PM MST
Originally delivered at: October 28, 2021 6:00 PM MDT

Instructions

Intro

When the Google Tag Manager library loads it declares a global JS object, dataLayer. It overloads the array prototype .push method so that it can grab on to objects/"events" pushed to that array.

Notes/Questions

  • What values are possible there for customer.status?
  • Populate customer.hubspot_canonical_vid, customer.auth0_id, chargebee_id if available. If not available, keep the key and use value javascript null.

Other Notes

data.value is the cart total (including tax and shipping, if any, minus any discounts) in whole currency units e.g. dollars not cents

data.currency is the 3 character currency code

data.discount_amount is number of total dollars discounted from the cart.

data.items.list_price is the undiscounted price per unit

data.items.unit_price is the discounts-applied price per unit

data.items.discount is the per-unit discount

data.items is an array e.g. contains multiple objects if there are multiple line items in the cart

data.purchase.is_renewal is true if the purchase is a license renewal, false if a first-time purchase

is_first_time* can be left out if not easily accessible in the app state

Change Log

  • 11/24/21: coupon to be array of strings instead of single string

Data Layer Event: PDQ - Purchase

Triggering Conditions

Upon a successfully validated purchase, after the load of the purchase confirmation route.

Event to Log

<script>
  var dataLayer = window.dataLayer || [];
  window.dataLayer.push({
    'event': 'purchase',
    'data': {}
  });
</script>

Description of Data Fields

Data Layer - purchase

Validation Schema does not have properties

Data Layer - customer

Validation Schema does not have properties

Data Layer - Item

Validation Schema does not have properties

JSON Validation Schema

For Super Techies:

The event payload, everything under the data property, will be validated against this schema. For more see JSONSchema standard.

{
  "TBD": "TBD"
}