MCPcopy Create free account
hub / github.com/dailydotdev/apps / WebPixelsProvider

Function WebPixelsProvider

packages/webapp/context/PixelsContext.tsx:96–174  ·  view source on GitHub ↗
({
  children,
}: PixelsContextProviderProps)

Source from the content-addressed store, hash-verified

94};
95
96function WebPixelsProvider({
97 children,
98}: PixelsContextProviderProps): ReactElement {
99 const context: PixelsContextData = {
100 trackSignup({ id, email, experienceLevel }) {
101 const urlParams = new URLSearchParams(window.location.search);
102 const isExtension = urlParams.get('ref') === 'install';
103
104 const isEngineer =
105 !!experienceLevel && experienceLevel !== 'NOT_ENGINEER';
106 if (typeof pixels.gtag === 'function') {
107 pixels.gtag('event', 'signup');
108 if (isEngineer) {
109 pixels.gtag('event', 'engineer_signup');
110 }
111 if (isExtension) {
112 pixels.gtag('event', 'extension_signup');
113 }
114 }
115
116 if (typeof pixels.fbq === 'function') {
117 const { fbq } = pixels;
118 hashEmailForMeta(email).then((emailHash) => {
119 pixels.updateFbUserData?.(id, emailHash);
120 fbq('track', 'signup');
121 const seniority =
122 experienceLevel && EXPERIENCE_TO_SENIORITY[experienceLevel];
123 if (seniority) {
124 fbq('track', `signup3_${seniority}`);
125 }
126 if (isEngineer) {
127 fbq('track', 'engineer signup');
128 }
129 if (isExtension) {
130 fbq('track', 'extension_signup');
131 }
132 });
133 }
134
135 if (typeof pixels.twq === 'function') {
136 pixels.twq('event', 'tw-o6izs-okoq6', {});
137 }
138
139 if (typeof pixels.rdt === 'function') {
140 pixels.rdt('track', 'SignUp');
141 }
142
143 if (typeof pixels.ttq?.track === 'function') {
144 pixels.ttq.track('CompletePayment', { value: 1 });
145 }
146 },
147 trackPayment() {
148 // if (typeof pixels.gtag === 'function') {
149 // pixels.gtag('event', 'purchase', {
150 // transaction_id: transactionId,
151 // value,
152 // currency,
153 // });

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected