Reddit¶
This guide provides a step-by-step approach to setting up Reddit Pixel and the Reddit Events API (CAPI) using Google Tag Manager (GTM) and a server-side container. This parallel tracking method is the most robust way to ensure accurate and resilient data collection for your Reddit advertising campaigns
Prerequisites¶
Before you begin, ensure you have the following:
-
Reddit Ads Manager: Access to the Reddit Ads Manager account, including the Events Manager for your specific Pixel.
-
Pixel ID and Access Token for the Reddit Events API, which can be obtained in Reddit Events Manager.
-
Web Google Tag Manager (GTM): Access to a web GTM container that is already implemented on your website and sends GA4 events to the server-side GTM. Learn how to share access to a GTM container.
-
Server-side GTM Container: A server-side GTM container provisioned by Usercentrics, available via a first-party endpoint, and configured to process GA4 events. Read our Get started page to learn how to set up a server-side GTM provided by Usercentrics.
Benefits of Server-Side Tagging for Reddit¶
-
Improved data accuracy: Server-side tagging bypasses ad blockers and browser privacy restrictions (like ITP/ETP), resulting in more reliable and complete conversion data.
-
Enhanced data control: You decide exactly what data to share with Reddit, allowing you to enrich or anonymize information to comply with privacy regulations (GDPR/CCPA). Shifting tagging from the browser to the server may also reduce the load on the JavaScript thread in the browser, improving site speed and Web Vitals, which can positively impact SEO.
-
Better attribution: With first-party cookies and more resilient event delivery, you can achieve more robust attribution for your Reddit campaigns.
Rollout plan¶
The implementation follows a parallel tracking model. This means you will send events from both the user's browser (via Reddit Pixel) and your server (via Reddit Conversions API). Reddit will then use a unique Event ID to deduplicate these events, ensuring that a single user action is only counted once.
Step 1: Implementation of parallel tracking¶
Part A: Web GTM (client-side) configuration¶
The goal of this step is to configure your website's GTM container to send data to your new server container and to fire the standard Reddit Pixel for browser-side tracking.
-
Create a Unique Event ID variable.
For deduplication to work, every event must have a unique ID that is identical for both the browser and server event.
-
In your web GTM container, go to Templates - New.
-
Name the template
Unique Event id. -
Paste the following snippet to the code section:
const copyFromDataLayer = require('copyFromDataLayer'); const setInWindow = require('setInWindow'); const copyFromWindow = require('copyFromWindow'); const getTimestampMillis = require('getTimestampMillis'); const generateRandom = require('generateRandom'); return getBrowserId() + '_' + getPageLoadId() + getGtmUniqueEventId(); function getGtmUniqueEventId() { let gtmId = copyFromDataLayer('gtm.uniqueEventId') || 0; return gtmId >= 0 ? gtmId : '00'; } function getBrowserId() { let gtmBrowserId = copyFromWindow('gtmBrowserId'); if (!gtmBrowserId) { gtmBrowserId = getTimestampMillis() + generateRandom(100000, 999999); setInWindow('gtmBrowserId', gtmBrowserId, false); } return gtmBrowserId; } function getPageLoadId() { let eventId = copyFromWindow('gtmPageLoadId'); if (!eventId) { eventId = getTimestampMillis() + generateRandom(100000, 999999); setInWindow('gtmPageLoadId', eventId, false); } return eventId; } -
In the Permissions section, under Reads data layer - Specific insert the following variable:
gtm.uniqueEventId.
Under Accesses global variables, add the two following Keys with Read and Write permission:gtmBrowserId.gtmPageLoadId -
Click Save.
-
Go to Variables - New.
-
Create a variable with name
CJS - Unique Event IDand variable typeUnique Event id.
-
-
Add Event ID to GA4 Event Tags:
Add a parameterevent_idand insert the {{CJS - Unique Event ID}} variable as a value on each GA4 event. -
Set up the Reddit Pixel Tag:
-
In your web GTM container, go to Tags - New.
-
Click Tag Configuration and search in the Community Template Gallery for the Reddit Pixel tag template.
-
Enter your Reddit Pixel ID. It's best practice to store this in a Constant variable.
-
For the Page Visit event (and other standard or custom events), insert the {{CJS - Unique Event ID}} variable in the Conversion ID field.
-
To include product data, do one of the following according to your data layer:
-
If you have standard GA4 purchase data layer, check the box Automatically collect and process Google Analytics ecommerce data.
-
If you don't have a standard GA4 data layer, check JSON Payload and write a custom JavaScript variable similar to that described in Part B.
-
-
Set the trigger to All Pages for the base Page Visit tag. For other events (e.g., Add To Cart, Purchase), use the appropriate triggers.
-
Note
The same triggers must be used for the Reddit and Google Analytics tags, to preserve the same event ID sent to the server container.
Note
Reddit Pixel hashes the Conversion Id with Sha256 (hex). The Reddit GTM Server Tag doesn't hash the ID, therefore the outgoing request contains an ID which looks different to the one in the Pixel. Reddit Server endpoint hashes the Conversion ID from Server GTM automatically if it is not hashed, but can process also hashed values. So, it's up to you whether to hash the ID in the Server GTM or not.
Part B: Server-side GTM (server-side) configuration¶
Configure the server container to receive the data from the web container and forward it to Reddit's Conversions API.
-
Create a product variable:
The Reddit template can not process GA4 products data out of the box. It needs to be transformed into
item_name,item_idanditem_categories.-
In your server GTM container, go to Variables - New.
-
Choose Event Data Variable and for key path use
items. -
Name this variable
Event Data - items. -
In your Server GTM container, go to Templates - New Variable Template.
-
Name the template
Reddit item. Under Fields, add a textFielditemArraywith Display nameitem. -
Under Code, paste the following:
// Enter your template code here. const JSON = require('JSON'); var item_array = data.itemArray; var reddit_item = []; if (typeof(item_array) !== "undefined") { for (var i = 0; i < item_array.length; i++) { reddit_item[i] = {}; reddit_item[i].id = item_array[i].item_id; // Start with the first category let categories = [item_array[i].item_category]; // Check for and add additional categories if they exist if (item_array[i].item_category2) { categories.push(item_array[i].item_category2); } if (item_array[i].item_category3) { categories.push(item_array[i].item_category3); } if (item_array[i].item_category4) { categories.push(item_array[i].item_category4); } if (item_array[i].item_category5) { categories.push(item_array[i].item_category5); } // Join the categories with " > " reddit_item[i].category = categories.join(" > "); reddit_item[i].name = item_array[i].item_name; } // Variables must return a value. return JSON.stringify(reddit_item); } -
Click Save.
-
Go to Variables - New.
-
Choose Reddit item Variable and use
Event Data - itemsvariable for Item field. -
Name this variable
Reddit item.
-
-
Set up the Reddit Conversions API tag:
-
Go to Tags - New.
-
Click Tag Configuration and search for the official Reddit Conversions API template.
-
Enter the same Pixel ID you used in the web container.
-
Generate Access Token in Reddit Events Manager under Conversions API. Create a variable in server-side GTM and provide it in the tag's field.
-
Event Name: Choose an event name from the list provided in the template (Purchase, Add To Cart, etc.)
-
Conversion ID: Map the event_id coming from GA4 (for deduplication).
-
-
Configure Advanced Matching parameters (recommended):
In the Reddit Conversions API template, you can improve Event Match Quality by sending hashed user parameters:
-
SHA256 Hashed Email (hex)
-
SHA256 Hashed Phone
-
SHA256 Hashed External ID
These should be collected from your GA4 data layer or other sources.
-
-
Set the properties (Product Information): check JSON Payload. Use
Reddit itemas JSON Payload. -
Set up triggering:
-
Set the trigger to fire on all GA4 client events.
-
Keep in mind to validate the consent.
-
-
Deduplication:
Ensure the sameConversion id (event_id)is passed from both web and server tags.
After the parallel tracking has been set up, you may need to wait some hours before the reported data from both the web pixel and the Conversions API become visible in the interface. Usually, you can expect a higher volume of server events surfacing in the reports. You may drill down on each event individually and verify that there are no abnormal discrepancies between the web and server events.

Deduplication rate should be around 50%.

Step 2: Quality assurance¶
Testing is critical. Use GTM's Preview mode and Reddit's Test Events view simultaneously.
Part A: Validation and debugging¶
Follow these steps to validate your setup:
-
Open Preview mode: start Preview mode in both your web and server-side GTM containers.
-
Open Reddit's Events Manager section, select the pixel and open Event testing section.

-
Copy the test ID which begins with “t2_“ and include it as test_id parameter in the Reddit template.
a. In your Server GTM container, go to Templates - Reddit Conversions API.
b. Open the Template and click on Code.
c. Replace theTest_modevariable withtest_id.
d. Click Save and accept the message that you will not get template updates anymore. After testing you need to reset the template to get updates again. -
Generate traffic:
a. Open your website from the web GTM's Preview tab. Open also the Preview tab of your server GTM.
b. Copy the website-address containinggtm_debugparameter into the field visible in the Event testing section and click on Open.
c. Navigate around and trigger the events you've set up.
-
Verify in web GTM: In the web GTM Preview, you should see your Reddit's Pixel tags firing. Click on a tag and inspect the Conversion ID being sent.
-
Verify in server-side GTM: In the server-side GTM Preview, you should see incoming requests from your GA4 client. Click on the Reddit Conversions API tag that fired. Inspect the Conversion ID in the outgoing request to Reddit. Compare it to the Conversion ID in the pixel.
It must match the Event ID from the Web GTM tag. Consider that Reddit Pixel hashes the Conversion id with Sha256 (hex) if you analyze the reddit requests in the browser network tools. -
Verify in Reddit Events Manager: In the Event testing section, you should see the event activity. Crucially, you will see events arriving from the browser pixel and the server. Both events must have the same Conversion ID. Not hashed Conversion IDs from server are hashed by Reddit before they are shown.
Part B: Expected challenges and solutions¶
Events not deduplicated or missing¶
Check that the exact same conversion id is passed from both Web GTM (Pixel tag) and Server-side GTM (CAPI tag), and that the event names match Reddit's format. In Preview, confirm the conversion id appears in both the browser request and the outgoing server request, and verify in Reddit Events Manager that events are labeled healthy and deduplication rate is about 50%.
Low match quality¶
Reddit requires an email address to improve the match quality. Check that you pass a hashed value of the valid and normalized email address.
Server events missing¶
Check server-side GTM preview under Tags - Outgoing Requests for Reddit API error responses.
Step 3: Final optimizations (optional but recommended)¶
-
Improve Event Match Quality: Systematically go through your data layer and user information available on the site. Work with your developers to expose more non-PII and PII (to be hashed) data points that you can send via the Conversions API. The more high-quality data you provide, the better your ad targeting and attribution will be.
-
Block Redundant Browser-Side Beacons: Once you are confident in your server-side setup, you can consider blocking certain Reddit Pixel tags from firing in the browser for specific users or situations (e.g., for logged-in users where you have rich server-side data) to further improve site performance. This is an advanced step and should be approached with caution.