Links

Tracking

Firework provides a way to attribute tracking events, such as "checkout" and "purchase", with additional properties like value and products

Embed Analytics Script Tag

Make sure the Firework script is injected into <header> at all your pages where you want to call the tracking function. Usually, it's the header of the checkout page.
<script async type="text/javascript" src="//asset.fwcdn3.com/js/analytics.js"></script>
Call analytics push whenever the purchase happens.

How to implement the "purchase" tracking event

function onPurchase() {
window._fwn.analytics.purchase({
order_id: '23423',
order_value: '35.54',
currency: 'CAD',
country: 'Canada',
subtotal: '31.89',
payment_method: 'AMEX',
product: [{ ext_product_id: '4483', price: 31, quantity: 1 }],
ext_customer_identifier: '1234-1234-1234-1234'
})
}
Note: The purchase function expects the following input shape:
export interface AnalyticsPurchaseData {
order_id: string
order_value: number
currency: string
country: string
subtotal?: number
payment_method?: string
product?: Array<{ ext_product_id: string; price: number; quantity: number }>
ext_customer_identifier?: string
}

Debugging issues with purchase tracking

To ensure that the purchase tracking is implemented correctly you can follow the steps below
  1. 1.
    Open browser developer tools
  2. 2.
    Goto "Sources" tab
  3. 3.
    Choose the "/thank_you" page
  4. 4.
    Find the part of the DOM which contains our tracking code snippet
  5. 5.
    Ensure there are no errors appearing anywhere in that code
To ensure that the data you are sending is accurate you may try printing the transaction data to the console. You may find all the information related to the Shopify transaction data here - https://shopify.dev/docs/api/liquid/objects/transaction
You will not be able to print out the entire transaction object as Shopify prevents this. However you will be able to inspect the part that you are interested in. For example something like this
let debugTransaction = {
payment_details: { { transaction.payment_details | json } }
}
console.log("debugTransaction: ", debugTransaction)

Shopify <> Firework Purchase Tracking

With the latest Firework app in Shopify, you do not need explicitly do any steps for implementing purchase tracking. The purchase tracking code is integrated automatically when the Firework app is installed in Shopify.
If you already have added the Firework purchase tracking snippet under your Order Status Page, we recommend removing that as updating to the latest Shopify app version will add the tracking code automatically.

Verifying purchase tracking in Shopify

You could perform a test purchase and on the order confirmation page, check for the user:purchase event in your network tab