On this page

Overview

Shopify's official help documentation on this new field can be found here. It's highly recommended to use the Shopify article for full technical details about this new field and how to implement conversion tracking properly.

📝Zipify Support can’t help with modifying or editing post-purchase page scripts. If you require further assistance, you can post in the Shopify Community or hire a Shopify Expert.

Conversion tracking scripts placed in the Settings > Checkout > Additional scripts > Order status page field in your Shopify admin rely on the Shopify "Order Confirmation" page to be visited for the customer's order, so they can be fired and track the initial order conversion. If a customer leaves your store on the post-purchase page, then no events on the order status page are tracked.

To ensure you're capturing conversions properly for all orders, even for those that don't reach the Shopify "Order Confirmation" page, the new Post-purchase page additional scripts field has been added at Settings > Checkout > Additional scripts > Post-purchase page in your Shopify admin:

This new field was added for the following purposes:

  1. To track the initial order conversion when the post-purchase upsell 1 page loads, to guard against buyer drop-off from Shopify Checkout to Order Confirmation page.

  2. In addition to the initial checkout conversion, this field and your script can also track post-purchase offer conversion(s).

📝The only HTML tag allowed in this field is <script>. The script runs within a sandbox and isn't included on the main page, meaning you aren't able to add code to this field to customize your post-purchase offer page(s). Running the script within a sandbox ensures that the script is secure and is used for its intended purpose.

⚠️ After you add a post-purchase page script, you also need to adjust your Order status page script to ignore events that are already captured by the post-purchase page script. More details here.

For example, you can use the following format for your scripts on the order status page:

{% unless post_purchase_page_accessed %} 
<script> //insert your tracking script </script>
{% endunless %}

Example: Facebook Pixel for post-purchase offer tracking

For natively integrated tracking found in the Online Store > Preferences section of your Shopify admin (Facebook Pixel and Google Analytics), those already capture events correctly on your post-purchase page for the initial order. Only event tracking for the post-purchase offer(s) is needed to be added.

Below is an example script for the Facebook Pixel that can be used to track the "Purchase" event for post-purchase offer conversions only:

<script>
!function(f,b,e,v,n,t,s)
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t,s)}(window, document,'script',
'https://connect.facebook.net/en_US/fbevents.js');

fbq('init', 'YOUR_PIXEL_ID');
</script>

<script>
Shopify.on('CheckoutAmended', function(newOrder, previousOrder) {
const prevOrder = previousOrder.order || previousOrder;
const oldItems = prevOrder.lineItems.map(function (line) {
return line.id;
});

const addedItems = newOrder.lineItems.filter(function (line) {
return oldItems.indexOf(line.id) < 0;
});

if (addedItems.length === 0) return;

const newItem = addedItems[0];

fbq('track', 'Purchase', {
content_type: 'product_group',
content_ids: [newItem.product.id],
value: newItem.finalPrice,
num_items: newItem.quantity,
currency: newOrder.currency
});
});
</script>

📝Make sure to include your Facebook Pixel ID where YOUR_PIXEL_ID is shown in the example script above.

More example scripts can be found here in Shopify's official documentation.

Additional Resources from Shopify

Below are the additional resources from Shopify's official help documentation on this new field. It's highly recommended that you or your developer review each section to ensure correct implementation:

Did this answer your question?