Skip to main content
Scripts

Reddit Pixel

Reddit Pixel helps you track conversions and build audiences for your Reddit advertising campaigns.

Use useScriptRedditPixel() to load Reddit Pixel and access its rdt API.

Reddit Pixel

View source

Nuxt Config Setup

Add this to your nuxt.config.ts to load Reddit Pixel globally. Alternatively you can use the useScriptRedditPixel composable for more control.

export default defineNuxtConfig({
  scripts: {
    registry: {
      redditPixel: {
        id: 't2_abc123defg',
        trigger: 'onNuxtReady',
      }
    }
  }
})

This config automatically enables first-party mode (bundle + proxy). See below to customise.

useScriptRedditPixel()

The useScriptRedditPixel composable lets you have fine-grain control over when and how Reddit Pixel is loaded on your site.

const { proxy } = useScriptRedditPixel()

proxy.rdt('track', 'Purchase', { value: 1, currency: 'USD' })

Please follow the Registry Scripts guide to learn more about advanced usage.

First-Party Mode: Privacy Focused Proxy

No extra config needed. The script is bundled from your domain (faster loads, no extra DNS lookup) and runtime requests are reverse-proxied through your server with automatic anonymisation (user IPs stay hidden from Reddit Pixel, works with ad blockers). Learn more.

Mode
Bundle Proxy Partytown
Privacy
All identifying data is stripped: IP, user agent, language, screen size, timezone, and hardware fingerprints.
export default defineNuxtConfig({
  scripts: {
    // ✅ First-party mode: bundled + proxied
    registry: {
      redditPixel: {
        id: 't2_abc123defg',
        trigger: 'onNuxtReady',
      },
    },
  },
})

Example

Using Reddit Pixel in a component with the proxy to send events .

<script setup lang="ts">
const { proxy } = useScriptRedditPixel()

// noop in development, ssr
// just works in production, client
function handleAction() {
  proxy.rdt('track', 'Purchase', { value: 1, currency: 'USD' })
}
</script>

<template>
  <div>
    <button @click="handleAction">
      Send Event
    </button>
  </div>
</template>

Initial page visit

The client initializer queues rdt('track', 'PageVisit') once after it queues init. It does not send another page visit on Nuxt route changes. Add your own route tracking if each client-side navigation should count as a PageVisit.

idstring required

Your Reddit Pixel advertiser ID.