Stape
Search
Try for free

Conversion tracking on Shopify upsell page with sGTM

Updated
Sep 10, 2024
Published
Jun 19, 2023

Shopify app store offers a vast variety of upsell apps. This is an excellent tool for store owners to maximize their revenue, but tracking conversions on the Shopify upsell page can be challenging.

One of the biggest issues marketers may experience while working with stores with Shopify upsell apps is that users who completed a purchase might think that the post-purchase page is already the final destination of their user journey. It is hard to blame them, as an order confirmation email has been sent, the money got withdrawn from the card, and in many cases, the upsell page may look like a thank_you page. Thus they simply close the tab/browser, never reaching the order status page, and your marketing pixels never track this conversion. Sad story, right? But do not worry, the problem is solvable, so let us share a few tricks in this blog post.

Conversion tracking on the order status page is pretty straightforward: you can pull data from Liquid by inserting dataLayer push scripts and then use GTM tags for tracking, you may insert marketing pixels directly, or you may use different apps that can generate dataLayer without any need to write a single line of code, such as Stape’s Server GTM app

One of the most significant issues on the Shopify upsell page we have encountered is that GTM does not load there as usual, thus your tags do not fire as you might expect. In this blog post we will describe one of the possible approaches to track your conversions using sGTM.

When accessed, the upsell page exists in some kind of limbo and scripting capability is very limited, that’s why web GTM container cannot be loaded. Luckily, the gtag library can be used to transfer the information from the upsell page to the server GTM container. To do so, you need to modify the gtag configuration by adding transport_url and first_party_collection parameters, so it would look like this:

transport_url and first_party_collection parameters

With this simple modification, the event and data associated with it will be transferred to the server GTM container and you’ll be able to access it via Event Data variables.

Shopify allows you to track initial order and upsell order separately. Here is an example of what data you might expect on the server GTM container:

track initial order and upsell order

Most of the Shopify upsell apps use the same order id for initial and upsell purchases, so we would suggest pushing a separate event called, for example, ‘upsell_purchase’ so GA4 would not discard a purchase event with the same transaction_id.

Observed unexpected behavior

One of the interesting bugs we’ve noticed is that, for unknown reasons, you are not able to send an ‘items’ array, you simply won’t see it in the Event Data. But if you call this parameter differently, on our screenshot it’s ‘items_array’, it can be accessed by the event data variable and then overwritten as a proper ‘items’ parameter in the GA4 tag.

Another issue you may face is that cookies are not always being sent with the HTTP request from the post-purchase page, which will cause attribution problems. Funny, despite all the restrictions you have on the upsell page, you still can retrieve all non http-only cookies using document.cookie method and send them as one of the event properties using gtag.

On the server GTM container you will be able to access the cookies string, parse it, find the cookie of your interest and send it as an overridden parameter by the tags that allow you to do so, like many tags developed by Stape, e.g. Facebook Conversion API tag, TikTok Events API tag, Outrain tag etc.

Conclusions

Tracking upsells on Shopify can be challenging but not impossible. For some businesses, it brings lots of additional revenue, so without proper tracking, this additional revenue can be depreciated by lower campaign performance due to missing data. If you are one of the businesses who needs both - additional income generated by upsells and as accurate tracking as possible - feel free to contact Stape agency - we will be happy to assist.

Tagged with:gtm serverShopify

Host your GTM server at Staperight now!