Skip to content
This repository has been archived by the owner on Jan 8, 2025. It is now read-only.

Add Reddit Pixel Tracking #477

Merged
merged 1 commit into from
Jun 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export const lato = localLato({
import "styles/varaibles.css";
import "styles/global.css";

const NEXT_PUBLIC_REDDIT_ID = process.env.NEXT_PUBLIC_REDDIT_ID;
const NEXT_PUBLIC_GTM_ID = process.env.NEXT_PUBLIC_GTM_ID;
const NEXT_PUBLIC_GTAG_ID = process.env.NEXT_PUBLIC_GTAG_ID;
const MUNCHKIN_ID = process.env.MUNCHKIN_ID;
Expand Down Expand Up @@ -162,6 +163,17 @@ const Analytics = () => {
{/* End Google Tag Manager (noscript) */}
</>
)}

{NEXT_PUBLIC_REDDIT_ID && (
<>
{/* Reddit Pixel */}
<Script id="reddit-pixel">
{`!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','${NEXT_PUBLIC_REDDIT_ID}');rdt('track', 'PageVisit');`}
</Script>
{/* DO NOT MODIFY UNLESS TO REPLACE A USER IDENTIFIER /*}
{/* End Reddit Pixel */}
</>
)}
</>
);
};
Expand Down
Loading