({
children,
}: PixelsContextProviderProps)
| 25 | } |
| 26 | |
| 27 | function WebPixelsProvider({ |
| 28 | children, |
| 29 | }: PixelsContextProviderProps): ReactElement { |
| 30 | const context: PixelsContextData = { |
| 31 | trackSignup({ id, email, experienceLevel }) { |
| 32 | const urlParams = new URLSearchParams(window.location.search); |
| 33 | const isExtension = urlParams.get('ref') === 'install'; |
| 34 | |
| 35 | const isEngineer = |
| 36 | !!experienceLevel && experienceLevel !== 'NOT_ENGINEER'; |
| 37 | if (typeof pixels.gtag === 'function') { |
| 38 | pixels.gtag('event', 'signup'); |
| 39 | if (isEngineer) { |
| 40 | pixels.gtag('event', 'engineer_signup'); |
| 41 | } |
| 42 | if (isExtension) { |
| 43 | pixels.gtag('event', 'extension_signup'); |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | if (typeof pixels.fbq === 'function') { |
| 48 | pixels.updateFbUserData?.(id, email); |
| 49 | pixels.fbq('track', 'signup'); |
| 50 | const seniority = |
| 51 | experienceLevel && EXPERIENCE_TO_SENIORITY[experienceLevel]; |
| 52 | if (seniority) { |
| 53 | pixels.fbq('track', `signup3_${seniority}`); |
| 54 | } |
| 55 | if (isEngineer) { |
| 56 | pixels.fbq('track', 'engineer signup'); |
| 57 | } |
| 58 | if (isExtension) { |
| 59 | pixels.fbq('track', 'extension_signup'); |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | if (typeof pixels.twq === 'function') { |
| 64 | pixels.twq('event', 'tw-o6izs-okoq6', {}); |
| 65 | } |
| 66 | |
| 67 | if (typeof pixels.rdt === 'function') { |
| 68 | pixels.rdt('track', 'SignUp'); |
| 69 | } |
| 70 | |
| 71 | if (typeof pixels.ttq?.track === 'function') { |
| 72 | pixels.ttq.track('CompletePayment', { value: 1 }); |
| 73 | } |
| 74 | }, |
| 75 | trackPayment() { |
| 76 | // if (typeof pixels.gtag === 'function') { |
| 77 | // pixels.gtag('event', 'purchase', { |
| 78 | // transaction_id: transactionId, |
| 79 | // value, |
| 80 | // currency, |
| 81 | // }); |
| 82 | // } |
| 83 | // |
| 84 | // if (typeof pixels.fbq === 'function') { |
nothing calls this directly
no outgoing calls
no test coverage detected