Installing the Spotify Pixel on Shopify

Step-by-step guide to install the Spotify Pixel in your Shopify instance

Applies to: Brands and Agencies

Spotify Ad Analytics has partnered with Shopify, a major eCommerce platform that offers small-to-medium sized businesses services around payments, marketing, shipping and customer engagement tools.

When implementing the Spotify Pixel on Shopify, make sure you have the ID for the Spotify Pixel you generated in Spotify Ad Analytics dashboard. Once you've done this, you'll go to Shopify to complete the standard implementation process.

Note: Many Shopify Themes have custom ways to add 3rd party JavaScript. Please talk to your Shopify admin or your developer to learn more about Shopify's capabilities.

Step 1

  • Create a Page View Event – Select Edit Code from the Theme Actions in Online Store > Themes

Step 2

  • Add the base JavaScript – Select theme.liquid from the available files and add the install code (can be found here). Make sure to add your unique Pixel ID to the Your Pixel ID section of the code.

Step 3

  • Additional Scripts – In order to add the purchase event to the checkout confirmation page you'll need to navigate to Settings > Checkout

  • Then you'll need to find Additional Scripts in the Order Processing section.

  • You can then add the following code replacing YOUR PIXEL ID with your Spotify Pixel ID from Spotify Ad Analytics:

  (function(w, d){
  var id='pdst-capture', n = 'script';
  if (!d.getElementById(id)){
    w.pdst = w.pdst || function() {(w.pdst.q = w.pdst.q || []).push(arguments);};
    var e = d.createElement(n); = id; e.async=1;
    e.src = '';
    var s = d.getElementsByTagName(n)[0];
    s.parentNode.insertBefore(e, s);
  w.pdst('conf', { key: 'YOUR PIXEL ID' });
  })(window, document);

  pdst("purchase", {
    value: / 100,
    quantity: ([]).reduce(function(a,b){return a+b}),
    currency: "USD",
    order_id: "",
    discount_code : "",

  • Select Save 

You're ready to measure!