How to install the Reddit pixel for Shopify

Alexander LamAlexander Lam


If you’re advertising with Reddit ads (or are planning to), you’ll need to add the Reddit pixel to Shopify.

But just adding the base pixel won’t be enough. Tracking when someone adds an item to their cart or finishes a purchase is super important as well.

In this guide, I’ll show you how to install the Reddit pixel in Shopify.

Ready? Let’s get started.

1. Add your Reddit base code to Shopify

Head over to your Reddit ads conversion page (

Log in if you haven’t yet, and click the Conversion Pixel button at the top left of the page.

A modal will appear with a block of code – this is your base code.

Copy the code. We’re going to paste it in the<head></head>tags of your store. You’ll find this within your theme.liquid file in Shopify. Here’s how:

  1. Head over to your store’s Shopify admin by selecting Online Store > Themes.
  2. For your current theme, click Actions and select Edit code.
  3. Under Layout, select theme.liquid.
  4. Ctrl+F and search for </head>
  5. Paste your base tag in the line before </head>

2. Track purchases generated by Reddit ads

Now for the important part – letting Reddit know when a purchase was made.

  1. From your Shopify admin, go to Settings > Checkout.
  2. Scroll down to the Order processing section to find the Additional scripts text box there.
  3. Paste the base tag code you got from part one in this box.
  4. Then paste the following code in the same box and save your settings.
        rdt('track', 'Purchase')

3. Track add to carts generated by Reddit ads

Finally, it can be important to know what ads generate Add to Carts as well.

This is the hard part – it takes a little searching. A basic understanding of HTML is helpful to have but not necessary. If you’re not comfortable with this part, I’d recommend the easy route.

  1. Let’s find your Add to Cart button’s ID first. We’ll use Chrome for this. Open up a product page on your shop and find the Add to Cart button. Right click on the button and click inspect from the popup menu.
  2. A screen with a bunch of code will appear – your button’s code will be highlighted. Look for the id property, it looks like id=”add-to-cart-button” but your text will be different. Write down the text within the quotation marks. In our example it’s add-to-cart-button.
  3. From your Shopify admin, go to Online Store > Themes.
  4. On your current theme, click Actions and select Edit code.
  5. Under Layout, select theme.liquid
  6. Ctrl+F or Command+F and search for </body>
  7. Paste the following code in the line before </body>. Then replace replace-this in the code with your button’s ID from step 2.
    {% if template contains 'product' %}
    var atcButtonID = "replace-this";
    var atcButton = document.getElementById(atcButtonID);
    	atcButton.addEventListener("click", function(event) {
                rdt('track', 'AddToCart')
    {% endif %}
  8. Save your theme and we should be good!

The easy route

Don’t want to go through the hassle of installing all that code yourself? Give Civil Pixels a try – we made this Shopify app to install all the tracking code for you.

For being an amazing reader of the rvere blog, use the code tamemypixels for a free month.

Track your Reddit conversions in 2 minutes with Civil Pixels.

That’s it!

Your Reddit ads conversions are now tracked. You can see which ads are the most effective.

If you’d like to find out how to track your conversions for Snapchat, Twitter, Google an d Facebook, check out our Shopify pixel guide.

Install every pixel in less than 2 minutes.

Start training your pixels now. Use the code tamemypixels when picking your plan for a free month.

civil pixels home graphic
Comments 2
  • Will
    Posted on

    Will Will

    Reply Author

    Thanks for this.

    I’ve managed to set up steps 1 and 3 but I cannot find the button id for my Add to Cart button. I’m using the theme Boundless. Do I need to set this ID elsewhere first?


    • Alexander Lam
      Posted on

      Alexander Lam Alexander Lam

      Reply Author

      Hey Will, Not all buttons have IDs, you may need to add one to your button if it doesn’t already have one.

      It’s probably in a file called product-template.liquid, just add something like id=”atc-button” to it! e.g. <a href="#" id="atc-button" class="atc">Add to Cart</a>