1function addRazorAnalytics() { 2 function loadScript(src) { 3 return new Promise((resolve, reject) => { 4 const script = document.createElement('script'); 5 script.src = src; 6 script.async = true; 7 script.onload = resolve; 8 script.onerror = reject; 9 document.head.appendChild(script); 10 }); 11 } 12 13 const analyticsScriptPromise = loadScript( 14 'https://razorpay.com/build/razor-analytics/razorAnalytics-1.min.js', 15 ); 16 17 const pluginsScriptPromise = loadScript( 18 'https://razorpay.com/build/razor-analytics-plugins/razorAnalyticsPlugins-1.min.js', 19 ); 20 21 function getLocale() { 22 const isSingaporeRoute = window.location.pathname.includes('/sg/'); 23 const isCurlecPage = window.location.hostname === 'curlec.com'; 24 const isUSRoute = window.location.pathname.includes('/us/'); 25 26 if (isSingaporeRoute) return 'SG'; 27 28 if (isCurlecPage) return 'MY'; 29 30 if (isUSRoute) return 'US'; 31 32 return 'IN'; 33 } 34 35 function getExperiments() { 36 const lambdaSplitzData = window.__LAMBDA_SPLITZ_DATA__ || {}; 37 const splitzExpIdVariantNameMap = {}; 38 Object.keys(lambdaSplitzData).forEach((expName) => { 39 const variantName = lambdaSplitzData[expName]?.name || ''; 40 splitzExpIdVariantNameMap[expName] = variantName; 41 }); 42 return splitzExpIdVariantNameMap; 43 } 44 45 Promise.all([analyticsScriptPromise, pluginsScriptPromise]) 46 .then(() => { 47 const plugins = window.razorAnalyticsPlugins; 48 if (!plugins) { 49 console.error('RazorAnalytics plugins not available'); 50 return; 51 } 52 const { lumberjack, segment } = plugins; 53 54 window?.razorAnalytics.init({ 55 plugins: [ 56 lumberjack({ 57 transportConfig: { 58 key: 'ezGnY9wN3IjNwgDM3MDMygzNwMTO04yy', 59 appName: 'onboarding-new-events', 60 url: 'https://lumberjack.razorpay.com/v1/track', 61 }, 62 }), 63 segment(), 64 ], 65 mode: window.location.host === 'razorpay.com' ? 'live' : 'debug', 66 pageConfig: { 67 captureSearchParams: true, 68 }, 69 experiments: getExperiments(), 70 eventProperties: { 71 locale: getLocale(), 72 app: 'framer', 73 }, 74 autoCapture: { 75 enabled: true, 76 customComponentAttributeName: 'data-framer-component', 77 linkClick: { 78 captureTextContent: true, 79 captureSearchParams: true, 80 }, 81 buttonClick: { 82 captureTextContent: true, 83 }, 84 scroll: { 85 enabled: true, 86 }, 87 }, 88 }); 89 }) 90 .catch((error) => { 91 console.error('Failed to load razorAnalytics', error); 92 }); 93} 94 95addRazorAnalytics();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.