Jump to content

What are all the placeholders that we can use when referring to specific order details such as  product id/SKU, quantity, and price?

Recommended Posts

I'm looking to run a script that will pull specific order details from the order confirmation page and pass that information over to a third party service. In this specific case, i'm using the Bazaarvoice Pixel. 
(For further information on the Bazaarvoice Transactional Pixel, please refer to the Bazaarvoice Knowledge Base.) 

I've taken the script provided by Bazaarvoice (which I've shown below) and added it to the Code Injection Tool in squarespace under the 'Order Confirmation Page' section. 

<script>
window.bvCallback = function(BV) {
    BV.pixel.trackTransaction({
        email: "
{customerEmailAddress}",
        currency: "USD",
        orderId: "
{orderId}",
        total: "
{orderGrandTotal}",
        items: [

            {
                price: "{price}",
                quantity: "{quantity}",
                productId: "{id}",
                
            },

        ]
    });
};

</script>

When I run a test by placing an order, the information is not being pulled into Bazaarvoice. Is there something about this script thats causing it to break in squarespace?

The only placeholders that I could find information on were the following:

  • {orderId}: The order number of the confirmed order
  • {orderSubtotal}: The subtotal of the confirmed order
  • {orderSubtotalCents}: The subtotal of the confirmed order, in cents
  • {orderGrandTotal}: The grand total of the confirmed order
  • {orderGrandTotalCents}: The grand total of the confirmed order, in cents
  • {customerEmailAddress}:The customer's email address, as it was entered in the "Billing Info" section

I've highlighted in orange, the ones that I found to be applicable to this particular instance. But theres a lot of other details that we don't have a placeholder for. Example) Product ID, Price, Quantity, etc.
I couldnt find any further documentation on injecting custom code to your website other than this: Code Injection on Squarespace.    

 

Edited by CreationForest
Accidentally sent before I finished writing everything out
Link to comment
  • Replies 2
  • Views 141
  • Created
  • Last Reply

Top Posters In This Topic

17 hours ago, CreationForest said:

I've taken the script provided by Bazaarvoice (which I've shown below) and added it to the Code Injection Tool in squarespace under the 'Order Confirmation Page' section. 

If your customer is checking out with non-subscription physical, download, or service products, you'll want to use the Order Status Page injection panel. The Order Confirmation Page injection panel is only for gift cards, memberships, and subscriptions.

If you want to retrieve the full order information that you've mentioned then you'll need to write further JavaScript to retrieve this. The Order Status page provides the {orderId} which you can then pass to the Orders API to retrieve the information as JSON. This can then be passed to BV.

Did this help? Please give feedback by clicking an icon below  ⬇️

Edited by paul2009

Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. 
Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links.
Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional.

Link to comment
On 7/11/2024 at 10:18 AM, paul2009 said:

If your customer is checking out with non-subscription physical, download, or service products, you'll want to use the Order Status Page injection panel. The Order Confirmation Page injection panel is only for gift cards, memberships, and subscriptions.

If you want to retrieve the full order information that you've mentioned then you'll need to write further JavaScript to retrieve this. The Order Status page provides the {orderId} which you can then pass to the Orders API to retrieve the information as JSON. This can then be passed to BV.

Did this help? Please give feedback by clicking an icon below  ⬇️

Thank you! This is very helpful. Do you happen to have a code example I can follow?

I went ahead and created an API Key. I then made a curl request from the command line to the Orders API. I was able to successfully authenticate it and save the response to a JSON file.  But what would I need to do from there? This is where I keep getting lost. Once we have the JSON file, what do I need to do in order to pass that information over to BV?  How do I get the bazaarvoice script to dynamically reflect the info I get from the orders API response? 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.