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="//"></script>

How to implement the "checkout" tracking event

Call analytics push whenever the checkout happens.
function onCheckout() {{
event: "checkout", // Mandatory field/value
order_id: "abc", // To prevent double counts
value: "35",
currency: "USD",
country: "US",

How to implement the "purchase" tracking event

function onPurchase() {{
order_id: '23423',
order_value: '35.54',
currency: 'CAD',
country: 'Canada',
subtotal: '31.89',
payment_method: 'AMEX',
cc_last4: '1111',
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
cc_last4?: string
product?: Array<{ ext_product_id: string; price: number; quantity: number }>
ext_customer_identifier?: string

Shopify <> Firework Purchase Tracking

This section outlines the steps to include the Firework purchase tracking script in the Shopify Checkout’s “Order Status” page.
Inside of your Shopify Admin dashboard, navigate to your Store Settings, then select “Checkout and accounts”. Scroll down to the section titled “Order status page”

Enter the Firework purchase tracking snippet

Copy and paste the following code snippet into the “Additional scripts” text box, then click “Save”. If you already have some code in this box, simply add the snippet underneath the existing code.
{% assign transaction = checkout.transactions | first %}
let products = [
{% for line_item in checkout.line_items %}
ext_product_id: '{{ line_item.product_id }}',
price: {{ line_item.final_price | money_without_currency }},
quantity: '{{ line_item.quantity }}'
{% endfor %}
function onFwAnalyticsScriptLoaded() {
let payload = {
order_id: '{{ checkout.order_id }}',
order_value: {{ checkout.total_price | money_without_currency }},
order_number: '{{ checkout.order_number }}',
currency: '{{ currency }}',
country: '{{ }}',
subtotal: {{ checkout.subtotal_price | money_without_currency }},
shipping_price: '{{ checkout.shipping_price | money_without_currency }}',
payment_method: '{{ transaction.payment_details.credit_card_company }}',
cc_last4: '{{ transaction.payment_details.credit_card_last_four_digits }}',
product: products,
<script onload="onFwAnalyticsScriptLoaded()" src="//"></script>

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 -
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)