@@ -4,7 +4,7 @@ import { fileURLToPath } from 'url';
44
55const AMPLITUDE_API_KEY = process . env . AMPLITUDE_API_KEY ;
66const AMPLITUDE_SERVER_URL = process . env . AMPLITUDE_SERVER_URL ;
7- const AMPLITUDE_SERVER_ZONE = process . env . AMPLITUDE_SERVER_ZONE || "US" ;
7+ const AMPLITUDE_SERVER_ZONE = process . env . AMPLITUDE_SERVER_ZONE || 'US' ;
88
99const currentPath = fileURLToPath ( import . meta. url ) ;
1010const projectRoot = path . dirname ( currentPath ) ;
@@ -14,7 +14,7 @@ if (AMPLITUDE_API_KEY) {
1414 const files = await fs . readdir ( 'entry-points' ) ;
1515 for ( const file of files ) {
1616 inject ( file ) ;
17- } ;
17+ }
1818 } catch ( err ) {
1919 console . error ( 'Error injecting Amplitude scripts:' , err ) ;
2020 }
@@ -33,13 +33,14 @@ async function inject(fileName) {
3333 !(function () {
3434 var e = "${ AMPLITUDE_API_KEY } ";
3535 e &&
36- (globalThis.amplitude.init(e${ AMPLITUDE_SERVER_URL
37- ? `, undefined, {
36+ (globalThis.amplitude.init(e${
37+ AMPLITUDE_SERVER_URL
38+ ? `, undefined, {
3839 serverUrl: "${ AMPLITUDE_SERVER_URL } ",
3940 serverZone: "${ AMPLITUDE_SERVER_ZONE } "
4041 }`
41- : ''
42- } ),
42+ : ''
43+ } ),
4344 globalThis.amplitude.setOptOut(!1),
4445 globalThis.addEventListener("dydx:track", function (e) {
4546 var t = e.detail.eventType,
@@ -49,7 +50,7 @@ async function inject(fileName) {
4950 globalThis.addEventListener("dydx:identify", function (e) {
5051 var t = e.detail.property,
5152 d = e.detail.propertyValue;
52- if ("walletAddress " === t) globalThis.amplitude.setUserId(d);
53+ if ("userId " === t) globalThis.amplitude.setUserId(d);
5354 else {
5455 var i = new globalThis.amplitude.Identify();
5556 i.set(t, d), globalThis.amplitude.identify(i);
@@ -67,4 +68,4 @@ async function inject(fileName) {
6768 await fs . writeFile ( htmlFilePath , injectedHtml , 'utf-8' ) ;
6869
6970 console . log ( `Amplitude scripts successfully injected (${ fileName } ).` ) ;
70- }
71+ }
0 commit comments