Install Reddit Pixel On Your Shopify Store - Lebesgue: AI CMO
Skip to content

Install Reddit Pixel On Your Shopify Store

Table of Contents

If you’re running Reddit ads—or even just thinking about giving them a try—setting up the Reddit Pixel on your Shopify store is a smart move. The pixel allows you to track conversions, build retargeting audiences, and optimize your ad performance based on real customer behavior.

In this quick guide, we’ll walk you through:

  • What the Reddit Pixel is and why it’s important

  • How to create your pixel in Reddit Ads Manager

  • How to add the pixel to your Shopify theme

  • How to verify it’s working correctly

Whether you’re new to Reddit Ads or looking to fine-tune your tracking, this setup will help you make the most of your ad spend.

What is the Reddit Pixel?

The Reddit Pixel is a small piece of JavaScript code that you add to your website, specifically, your Shopify store. Its job is to track what visitors do after they click on your Reddit ads.

As we already wrote, installing pixels is a crucial part of running any advertising campaign.

It helps you determine how traffic behaves on the website, and it feeds information back to the advertising platform (in this case, Reddit) to help optimize your ads and find customers similar to those who do right events on your website.

There are two types of pixel technologies: first-party pixel and third-party pixel.

And, when talking about tracking pixels like the Reddit Pixel, you might hear about first-party and third-party technologies.

Here’s a quick breakdown:

  • First-party pixel: This type of pixel is associated directly with the domain the user is visiting. So if someone is on your Shopify store and the pixel fires from your domain, it’s considered a first-party pixel. First-party data is generally more reliable and less likely to be blocked by browsers.

  • Third-party pixel: This pixel is served from a domain that’s not the one the user is visiting, like Reddit, Facebook, or Google. Since it’s coming from a different source, browsers and privacy tools are increasingly limiting the data third-party pixels can collect. It’s considered to be third-party data, as it’s built by Reddit, and it helps improve Reddit’s performance

The Reddit Pixel is a third-party pixel, meaning it is hosted by Reddit and tracks data from your site back to their servers. While still effective, it’s subject to tracking limitations in browsers like Safari (with Intelligent Tracking Prevention) and Firefox.

To improve tracking reliability, some platforms are moving toward server-side tracking or integrating with first-party data solutions, like Le Pixel

The goal of this pixel is to connect data through different marketing sources and determine which marketing channels really impact your growth and customer acquisition process. Le Pixel sets up server-side tracking on your website, and it’s considered to be first-party tracking technology, which improves tracking, decision making, and standardizes marketing reporting

How to Install Reddit Pixel on Shopify Store?

Setting up the Reddit Pixel in your Shopify store is simple and takes just a few minutes. We can break down the Reddit pixel implementation for Shopify in two phases:

  1. Phase one – baseline pixel to track page views and web interactions
  2. Phase two – conversion tracking pixel to track purchases.

Phase One: Install the Baseline Pixel

In this initial phase, your goal is to install the Reddit Pixel base code on your Shopify store to start tracking pageviews and general web activity. This gives you foundational data like:

  • Which pages users are visiting after clicking your Reddit ads

  • How much time they’re spending on your site

  • How they’re navigating between product pages, collections, and content

Step 1: In the Reddit Ads, go to the events manager and click on Configure pixel. A pop-up like this will show, where you click “Set up manually.”

set up Reddit pixel for Shopify manually

On image below you can see all  events, metadata, and attribution settings you want to track – select all that is possible, as each one of these properties and features can improve your tracking.

attribution options for Reddit pixel

Step 2: Now, go to your theme.liquid file in the shopify dashboard (Online store -> Customimze code -> theme.liquid) and paste this code above the </head> section of the website:

					<script>
<!-- Reddit Pixel -->
<script>
!function(w,d){if(!w.rdt){var p=w.rdt=function(){p.sendEvent?p.sendEvent.apply(p,arguments):p.callQueue.push(arguments)};p.callQueue=[];var t=d.createElement("script");t.src="https://www.redditstatic.com/ads/pixel.js",t.async=!0;var s=d.getElementsByTagName("script")[0];s.parentNode.insertBefore(t,s)}}(window,document);rdt('init','INSERT_PIXEL_ID');rdt('track', 'PageVisit');
</script>
<!-- DO NOT MODIFY UNLESS TO REPLACE A USER IDENTIFIER -->
<!-- End Reddit Pixel -->

				

Click the save button, and your baseline pixel should be installed.

After this has been done, make sure to turn on auto-advanced matching.

active auto-advanced matshing option for pixel tracking

At this phase, you should see that the baseline pixel is successfully reporting pageviews.

Once this baseline is in place and verified, you can move on to Phase Two, where you’ll configure custom events like purchases, sign-ups, or other conversions.

active base pixel for Reddit ads

A nice bonus step after setting up this baseline code is using the events manager to set up web events such as Add to cart, Sign up, Search, or Viewed product. You can read more about it here.

Phase Two: Install the Reddit Purchase Conversion Tracking Pixel

Once your baseline Reddit Pixel is live and tracking pageviews, it’s time to take things further by tracking actual conversions, like when someone makes a purchase on your store. This is critical for measuring the effectiveness of your Reddit ads and optimizing them for return on ad spend (ROAS).

This is a bit harder part, and this installation guide supports both Shopify Plus and non-Shopify Plus members.

Here’s how to set up purchase tracking:

Step 1: In the bottom left corner of your Shopify store, go to the settings page, and click on the Customer Events section. In the upper right corner, click “Add custom pixel”.

first step in adding Reddit pixel code to Shopify

Name your pixel something clear and intuitive ,like “Reddit Ads Purchase Tracking” will work.

Step 2: Now, in the Customer privacy section, set it up like this below, if you fall into GDPR or CCPA legislation. If not, most likely permission to collect data is not required – but make sure to check this with your legal department.

customer privacy settings

Step 3: Now, copy and paste the code below, and make sure to replace PIXEL_ID with your pixel ID:

					!function(w,d){
  if(!w.rdt){
    var p=w.rdt=function(){
      p.sendEvent ? p.sendEvent.apply(p,arguments) : p.callQueue.push(arguments)
    };
    p.callQueue=[];
    var t=d.createElement("script");
    t.src="https://www.redditstatic.com/ads/pixel.js",t.async=!0;
    var s=d.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(t,s)
  }
}(window,document);

rdt('init','{{PIXEL_ID}}', {
  "optOut":false,
  "useDecimalCurrencyValues":true
});

analytics.subscribe("page_viewed", (event) => {
  rdt('track', 'PageVisit');
});
 
analytics.subscribe("product_viewed", (event) => {
  rdt('track', 'ViewContent', {
     products: {
      id:  event.data.productVariant.sku,
      category:  event.data.productVariant.product.type,
      name:  event.data.productVariant.product.title
    }
  });
});

analytics.subscribe("product_added_to_cart", (event) => {
  const cartLine = event.data.cartLine;
  rdt('track', 'AddToCart', {
    currency: cartLine.merchandise.price.currencyCode,
    value: cartLine.cost.totalAmount.amount,
    itemCount: cartLine.quantity,
    products: {
      id:  cartLine.merchandise.sku,
      category:  cartLine.merchandise.product.type,
      name:  cartLine.merchandise.product.title
    }
  });
});

analytics.subscribe("checkout_completed", (event) => {
  const checkout = event.data.checkout;
  rdt('track', 'Purchase', {
    currency: checkout.currencyCode,
    value: checkout.totalPrice.amount,
    itemCount: checkout.lineItems.reduce((total, item) => total + item.quantity, 0),
    conversionId: checkout.order.id,
    products: checkout.lineItems.map(item => ({
      id: item.variant.sku,
      category: item.variant.product.type,
      name: item.title
    }))
  });
});

				

To clarify it, this JavaScript snippet sets up Reddit’s advertising tracking on your checkout page and then listens for specific analytics events (like page views and purchase events) to send corresponding tracking data to Reddit.

Here’s a detailed breakdown of what the code does:

  1. Initializing the Reddit Pixel
  2. Subscribing to Analytics Events.

Initializing the Reddit Pixel

After setting up the function, the code  initializes the Reddit tracking pixel with a unique tracking ID and passes some configuration options:

  • optOut: Whether to opt out of tracking.
  • useDecimalCurrencyValues: Whether to use decimal values for currency amounts.

Subscribing to Analytics Events

The script listens for various events from an analytics system (likely part of the website’s own tracking or e-commerce platform) and then forwards these events to Reddit via the rdt function:

Page Viewed Event: – This logs a simple page visit event.

Product Viewed Event: –  When a “product_viewed” event occurs, it sends additional product information (SKU, product type, and title) 

Product Added to Cart Event: –  On detecting a “product_added_to_cart” event, the script gathers details about the cart line (including the product SKU, type, title, currency, total amount, and quantity) 

Checkout Completed Event: When a “checkout_completed” event is detected (indicating a successful purchase), it aggregates checkout details such as the total price, currency, and the number of items purchased. It then maps over each purchased product to include its SKU, type, and title

After you’ve copied/pasted this code, click the Save button in the middle of the page (you can sometimes miss it, it’s at the top of the page as shown below, and the Connect button after that.

reddit purchase pixel

After this, you should see Reddit pixel status is set to connected, as on this page:

custom reddit ads purchase

And that’s it! 

You’ve now successfully set up the Reddit Pixel on your Shopify store, from tracking basic pageviews to recording purchase conversions. With this in place, you can start gathering valuable data, optimize your campaigns, and getting a clearer picture of how Reddit ads are contributing to your store’s growth.

Summing Up

Now that you’ve got the Reddit Pixel installed on your Shopify store, you’re ready to run ads that actually track what’s happening. From seeing who visits your site to knowing exactly when someone makes a purchase, the pixel gives you the data you need to improve your results and make smarter ad decisions.

And if you want to go a step further and start collecting first-party data, which is more reliable and privacy-friendly, try Le Pixel. It’s our tool that helps you track customer behavior more accurately, even when third-party cookies fall short.

Make smarter marketing decisions today.
100+ five-star reviews on Shopify App Store

Recommended Posts

welcome flow optimization cover

How to Create a High-Converting Welcome Flow

Learn how welcome flow optimization can turn new signups into engaged customers with the right email sequence.
Read More
marketing pixel technology cover

Why Is a Marketing Pixel Important?

Want to improve ad performance and understand customer interactions? A marketing pixel tracks valuable data to optimize your campaigns—here’s how it works.
Read More
meta ads forecast cover

Meta Ads Forecast: Optimize your ad budget

Optimize campaigns with Facebook Forecast Insights—predict ad performance, plan budgets, and stay ahead of trends.
Read More