One Click Upsell - Post Purchase Page - Additional Scripts

I’m looking to track upsells on the post-purchase page by adding scripts in the additional scripts section. I’m using One Click Upsell - Zipify OCU.
But Javascript doesn’t seems to be working on the post-purchase page and the “window.Shopify.order” global variable is not accessible.
I would really appreciate if anyone has any information regarding this issue.
Thanks

3 Likes

Hey, I believe the scripts in post purchase page is sandboxed and you can’t use liquid code here unlike the order status page. Check this doc on what are the available variables there https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/pixel-tracking-post-purchase-page

From my testing adding this to post purchase page additional script


I got the following response:

{
    "id": 491614412331222,
    "number": 10001,
    "checkoutToken": "7a4ee4ded2342341233423497ff0d7223959b",
    "lineItems": [
        {
            "id": 123123123123123,
            "finalLinePrice": "6.40",
            "finalPrice": "6.40",
            "lineLevelTotalDiscount": "1.60",
            "optionsWithValues": [
                {
                    "name": "Title",
                    "value": "Default Title"
                }
            ],
            "originalLinePrice": "8.00",
            "originalPrice": "8.00",
            "price": "8.00",
            "product": {
                "id": 7147960401963,
                "type": ""
            },
            "properties": [],
            "quantity": 1,
            "title": "Sample Product",
            "variant": {
                "id": 490493583249232,
                "sku": ""
            }
        }
    ],
    "subtotalPrice": "6.40",
    "totalPrice": "12.23",
    "currency": "USD",
    "discounts": [
        {
            "type": "PercentageDiscount",
            "code": "SUMMER",
            "amount": "1.60"
        }
    ],
    "customer": {
        "id": 123123123,
        "email": "ozzy.osbourne@hmail.com",
        "acceptsMarketing": false,
        "hasAccount": false,
        "firstName": "Ozzy",
        "lastName": "Osbourne",
        "ordersCount": 0,
        "totalSpent": "0.00"
    }
}

Hope this helps.