Adding 3rd Party Pixel Tracking on Post Purchase
Promotions firing on the Post Purchase page now support tracking scripts through the use of a secondary Additional Scripts input within the Shopify admin. Navigate to Settings > Checkout > Additional Scripts. You'll see a new Post-purchase page section where you can insert tracking scripts to fire on post purchase.
Official Documentation: https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/pixel-tracking-post-purchase-page
In this article
Limitations
- Tracking scripts on post purchase will not be added to the thank you page.
- Tracking scripts on post purchase do not allow liquid code, only JavaScript.
- Tracking scripts on post purchase do not allow any HTML tags other than <script>.
- Tracking scripts on post purchase run within a sandbox so they are not included within the main checkout page. This ensures the security and safety of checkout.
**Shopify Plus stores: If you customized checkout.liquid, you need to upgrade to the most recent checkout version first. The new tracking field will show up in your settings, but not fire any events. Please ask your MSM
How to Prevent Double Tracking Conversions
If scripts are incorrectly setup on the post purchase page, it's possible that the purchase will be counted twice (both on the post purchase page and on the thank you page). Learn more on Shopify's article.
To avoid double tracking, ensure that you wrap scripts on the post purchase page that should only be run once with:
if (!Shopify.wasPostPurchasePageSeen) {
To avoid double tracking on the thank you page, ensure that you wrap scripts with:
{% unless post_purchase_page_accessed %}{% endunless %}
Common Questions
Can I Remove the Tracking Scripts from the Order Status Page Section?
You should continue to include tracking scripts within both areas as not all orders will activate post purchase and so it's important to continue firing tracking scripts for any order that does not see the post purchase page.
Is Liquid Supported within the Post-purchase page Additional Script Section?
No, unlike the Order status page section, Liquid can not be used on the post purchase page. This is a Shopify limitation in order to ensure the security and privacy of checkout. Instead, Shopify introduces a new window.Shopify Javascript object which surfaces most of the order data required to get order conversion tracking working. The full API of available properties can be found here: https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/pixel-tracking-post-purchase-page#table-heading-window. Consult with a developer on how to correctly implement your specific pixels on post purchase.
How Do I Prevent Double Tracking?
Considering the fact that by including the same tracking pixels on post purchase, a customer may fire the same pixel twice leading to inaccurate and inflated conversion data. To avoid this issue, Shopify has introduced a new liquid variable called post_purchase_page_accessed that can be used within the Order Status Page section to prevent firing tracking scripts when the order has already viewed the post purchase page. You will also want to surround any tracking pixels within the Post-purchase page section of Addition scripts with the Shopify.wasPostPurchasePageSeen boolean to ensure if a customer refreshes the post purchase page that the order is not tracked twice.
You can write an IF conditional state within the "Order status page" section using liquid: {% if post_purchase_page_accessed == false %}
For example:
Does Checkout Promotions Offer Support in Integrating our Tracking Scripts on Post Purchase?
At this time, Checkout Promotions does not offer support in setting up tracking scripts on the post purchase page.
How Do I Test My Tracking Scripts on Post-purchase?
You will need to place a test order that activates post purchase in order to test the tracking script implementations.
How Do I Track Post Purchase Conversion Data?
You can now also track the post purchase conversion data using the Shopify.on handler and subscribing to the CheckoutAmended event. Shopify will fire the CheckoutAmended event whenever an offer is redeemed by the customer. At the same time, the global window.Shopify object is updated with the latest order data that includes post purchase conversion data. It's important to note that conversions which result in a partial paid status (payment could not be processed) will still reflect on the updated order data. As a result, totals collected within tracking scripts may be higher than those reported by Checkout Promotions and Shopify.