Skip to main content
All CollectionsIntegrating our service
How to add a custom pixel in Shopify
How to add a custom pixel in Shopify

If you have switched to Shopify's new one-page checkout, you will need to add code via a custom pixel.

Brittnee Tensmeyer avatar
Written by Brittnee Tensmeyer
Updated over a week ago

If you have switched to Shopify's new one-page checkout (checkout extensibility), please add the code below via a custom pixel. With this code we will capture the customer email address, order number, and products they purchased. With the "Email All" setting enabled, we will send your customers a post purchase email asking them for a review.

In order for this to work, you must have the "Email All" setting enabled in your Shopper Approved account. To enable that setting, log in to your Shopper Approved account, navigate to Setup > Seller Ratings and scroll down until you see the "Email All" setting.

​You will also want to make a note in your privacy policy that you share email addresses with a third party. We only use email addresses in this instance to send customers the post purchase email asking for a review.



Pixel Code

You will add your unique Site ID and Initial Survey Token in the first two lines of the code snippet.

Replace the Site ID and token below. To find your Site ID and Initial Survey Token, log in to your Shopper Approved account, click on your name in the upper right hand corner > Settings and you will find this information under Domain Information.

Here is the code you will place via a custom pixel in Shopify.

var siteID = XXXXX; //populate SA Site ID

var siteToken = 'YYYYY'; //populate SA Token

window.sa_values = { "site":siteID, "token":siteToken, 'orderid':'', 'name':'', 'email':'', 'country':'', 'state':'' }; //declare sa_values window.sa_products = {}; //declare sa_products analytics.subscribe("checkout_completed", event => { //Subscribe to the checkout_completed order events const checkout = event.data.checkout; for(var i = 0; i < checkout.lineItems.length; i++){ //loop through purchased items sa_products[checkout.lineItems[i].variant.id] = checkout.lineItems[i].title; } if(sa_values.country!=undefined) sa_values.country=checkout.billingAddress.countryCode; if(sa_values.state!=undefined) sa_values.state=checkout.billingAddress.provinceCode; if(sa_values.orderid!=undefined) sa_values.orderid=checkout.order.id; if(sa_values.name!=undefined) sa_values.name=checkout.billingAddress.firstName + " " + checkout.billingAddress.lastName; if(sa_values.email!=undefined) sa_values.email=checkout.email; function saLoadScript(src) { var js = window.document.createElement("script"); js.src = src; js.type = "text/javascript"; document.getElementsByTagName("head")[0].appendChild(js); } saLoadScript("https://www.shopperapproved.com/thankyou/rate/" + siteID + ".js") });



1. To place the code in Shopify, login to your Shopify store, go to Settings > Customer Events > Add a custom pixel.

2. Name the pixel "Shopper Approved".

3. Place the code from above and Connect.

Please also ensure that the "Email All" setting is enabled within your Shopper Approved account under (Setup > Seller Ratings), and that your privacy policy is updated. You must make sure your posted privacy policy notifies your customers that you may share their email addresses with a third party.

Placing a Test Order

Once the code has been added, please place a test order to make sure the pixel is working correctly:

Did this answer your question?