Firework for Developers
One-to-one Virtual ShoppingBusiness Portal
  • Welcome to Firework for Developers
  • Firework Interactive Video and One-to-many Digital Showroom
  • Web
    • Getting Started (Web)
      • Shopify
      • Magento
      • Wordpress (WooCommerce)
      • Salesforce Commerce Cloud
      • BigCommerce
    • Integration Guide for Web
      • Components
        • Hero Unit
        • Carousel / Grid
        • Storyblock (Web)
        • Player (Floating)
        • Storylink
      • Styling
      • Feed Attributes
      • Player
        • Configuration
          • Appearance
      • Video customization
        • Video Factory
        • CTA Button
        • Product cards
      • Events
        • Embed Feed and Storyblock Events
        • Video player events
        • Live stream events
        • Shopping events
      • Shopping Integration (V2)
        • Introduction
        • Shopping APIs
        • Product Hydration
        • Product Factory
        • Cart Sync
        • Tracking
          • Purchase
          • Add to cart
          • Remove from cart
          • Page viewed
        • Shopping Integration FAQ
        • Migrate from V1
      • Web SDK
      • Enhanced Picture-in-Picture
      • Privacy settings
        • Tracking settings
        • Cookies management
        • Content Security Policy
    • Telemetry console
    • Firework Service Domains
    • FAQ & Troubleshooting (Web)
  • Android SDK
    • Integration Guide for Android SDK
      • Getting Started (Android)
      • Video Feed (Android)
        • Video Feed Layouts (Android)
        • Channel Feed (Android)
        • Discover Feed (Android)
        • Playlist Feed (Android)
        • Dynamic Content Feed
        • Channel Hashtags Feed
        • Sku Feed
        • Single Content Feed
        • Configure Video Feed
      • Customization
        • CTA
      • Analytics (Android)
      • Shoppable Videos (Android)
        • Product Hydration
      • Live Stream Support (Android)
      • Video Player (Android)
      • StoryBlock (Android)
      • Share & Video Deep linking
      • Ad Support (Android)
      • Configure Video Advertisements Source (Android)
      • In-app Language Switches
      • Compose support(Android)
    • Sample App (Android)
    • FAQ & Troubleshooting (Android)
    • Changelog (Android)
  • iOS SDK
    • Integration Guide for iOS SDK
      • Getting Started (iOS)
      • ATT compliance (iOS)
      • Video Feed (iOS)
        • Discover Feed(iOS)
        • Channel Feed (iOS)
        • Playlist Feed (iOS)
        • Playlist Group Feed (iOS)
        • Dynamic Content (iOS)
        • Hashtag Playlist (iOS)
        • SKU Playlist (iOS)
        • Video Ads (iOS)
        • Video Feed Layouts (iOS)
      • Story Block (iOS)
      • Customization (iOS)
        • Video feed configurations (iOS)
        • Player configurations (iOS)
        • Shopping configurations (iOS)
          • Customize product card on videos using the custom view (iOS)
        • Customize click behaviors (iOS)
      • Shopping (iOS)
      • Live Stream Support (iOS)
      • Analytics (iOS)
      • Share & Deeplinking(iOS)
      • Ad Support (iOS)
    • Sample App (iOS)
    • FAQ & Troubleshooting (iOS)
    • Changelog (iOS)
  • React Native SDK
    • Integration Guide for React Native SDK V2
      • Getting Started (React Native)
      • ATT compliance React Native (iOS)
      • Video Feed (React Native)
      • Story Block (React Native)
      • Customization (React Native)
        • Video feed configurations (React Native)
        • Player configurations (React Native)
        • Shopping configurations (React Native)
          • Customize product card on videos using the custom view (React Native)
        • Customize click behaviors (React Native)
      • Shopping (React Native)
      • Live Stream Support (React Native)
      • Ad Support (React Native)
      • Analytics (React Native)
      • App-level Language Setting (React Native)
      • Share & Video Deeplinking (React Native)
      • Android Style (React Native)
      • Inject Android Image Loader (React Native)
      • Integrate SDKs in Hybrid React Native and native Apps
      • Reference (React Native)
      • Sample App (React Native)
      • FAQ & Troubleshooting (React Native)
      • Changelog (React Native)
  • Flutter SDK
    • Integration Guide for Flutter SDK V2
      • Getting Started (Flutter)
      • ATT compliance Flutter (iOS)
      • Video Feed (Flutter)
      • Story Block (Flutter)
      • Customization (Flutter)
        • Video feed configurations (Flutter)
        • Player configurations (Flutter)
        • Shopping configurations (Flutter)
          • Customize product card on videos using the custom view (Flutter)
        • Customize click behaviors (Flutter)
      • Live Stream Support (Flutter)
      • Shopping (Flutter)
      • Ad Support (Flutter)
      • Analytics (Flutter)
      • App-level Language Setting (Flutter)
      • Share & Video Deeplinking (Flutter)
      • Inject Android Image Loader (Flutter)
      • Android Style (Flutter)
      • Integrate SDKs in Hybrid Flutter and native Apps
      • Reference (Flutter)
      • Sample App (Flutter)
      • FAQ & Troubleshooting (Flutter)
      • Changelog (Flutter)
  • Help Articles
    • Importing Products to Firework
    • Adding products to a video
    • Displaying product videos on product pages using hashtag filtering(Web)
    • Syncing Carts
    • Encoded IDs
Powered by GitBook
On this page
  • How to implement the "purchase" tracking event
  • Debugging issues with purchase tracking
  • Shopify <> Firework Purchase Tracking
  • Verifying purchase tracking in Shopify

Was this helpful?

  1. Web
  2. Integration Guide for Web
  3. Shopping Integration (V2)
  4. Tracking

Purchase

The following describes how purchase tracking is done for Firework.

How to implement the "purchase" tracking event

Please ensure you send all the purchase events happening in your website to us. Please do not filter out any events on your side. This information is required to identify your Firework attributed vs Non Firework purchases. This also helps us calculate the lift in GMV and AOV with Firework.

<script>
    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_parent_product_id:'6692',
               ext_product_id: '4483', 
               parent_product_name:'V-Neck Tshirt',
               product_name:'V Neck Tshirt - L Blue', 
               price: 31, 
               quantity: 1,
               currency: 'CAD',
               url: "https//www.xx.com/product/xxx"
           }]
            //ext_parent_product_id is the ID of the parent product and ext_product_id is the variant ID. Same goes for title as well
        });
    }
    //Call the function when purchase happens or on the load of thank you or order confirmation page
    document.addEventListener('DOMContentLoaded', function() {
        onPurchase();
    });
</script>

Note: The purchase function expects the following input shape:

export interface PurchaseData {
  ext_customer_identifier?: string //customer_identifier from customer site
  order_id: string //Order ID from customer site
  order_value: number //Total value of order
  currency: string //Currency, for example: USD
  country: string  //Country code, for example: US
  subtotal: number //Subtotal, without shipping fee. usually order_value = subtotal + shipping fee.
  payment_method?: string // payment method: for example: creditcard, bank, paypal, others
  product: Array<{ 
    ext_parent_product_id:string; //product_id
    ext_product_id:string; //unit_id or variant_id
    parent_product_name:string;  //product name
    product_name:string; //unit name or variant name
    image?: string; //image
    sku?: string: //sku
    price: number; //price of variant
    currency: string; //currency
    quantity: number; //quantity
    url: string // url link for variant or product 
  }>
}

Example:

{
    "order_id": "61947935457",
    "order_value": 57.98,
    "currency": "USD",
    "country": "US",
    "subtotal": 49.99,
    "product": [
      {
        "ext_parent_product_id": "xxxxxxxx",
        "ext_product_id": "xxxxxx",
        "parent_product_name": "xxxxxx",
        "product_name": "XXXX",
        "image": "https://cdn.xxxx.com/s/files/xxx.png",
        "price": 49.99,
        "currency": "USD",
        "quantity": 1,        
        "url": "https://xxx.com/products/xxxx"
      }
    ]
}

Debugging issues with purchase tracking

To ensure that the purchase tracking is implemented correctly you can follow the steps below

  1. Open browser developer tools

  2. Goto "Sources" tab

  3. Choose the "/thank_you" page

  4. Find the part of the DOM which contains our tracking code snippet

  5. Ensure there are no errors appearing anywhere in that code

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

PreviousTrackingNextAdd to cart

Last updated 16 days ago

Was this helpful?

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