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

Commit

Permalink
feat: add reddit pixel tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
TuukkaIkius committed Jun 18, 2024
1 parent 03c03f7 commit cac00e1
Showing 1 changed file with 12 additions and 0 deletions.
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

0 comments on commit cac00e1

Please sign in to comment.