@formo/analytics 1.11.11 → 1.11.13-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formo/analytics",
3
- "version": "1.11.11",
3
+ "version": "1.11.13-alpha.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/getformo/sdk.git"
@@ -234,17 +234,21 @@ export class FormoAnalytics implements IFormoAnalytics {
234
234
  }
235
235
  }
236
236
 
237
- async buildPageEventData(location: string | undefined, language: string): Promise<Record<string, unknown>> {
237
+ async buildPageEventData(
238
+ location: string | undefined,
239
+ language: string
240
+ ): Promise<Record<string, unknown>> {
238
241
  const url = new URL(window.location.href);
239
242
  const params = new URLSearchParams(url.search);
240
-
243
+
241
244
  const address = await this.getAndStoreConnectedAddress();
242
245
  if (address === null) {
243
246
  console.warn('Wallet address could not be retrieved.');
244
247
  }
245
-
246
- const eventData: Record<string, unknown> = {
248
+
249
+ return {
247
250
  'user-agent': window.navigator.userAgent,
251
+ address,
248
252
  locale: language,
249
253
  location,
250
254
  referrer: document.referrer,
@@ -255,12 +259,6 @@ export class FormoAnalytics implements IFormoAnalytics {
255
259
  utm_campaign: params.get('utm_campaign'),
256
260
  ref: params.get('ref'),
257
261
  };
258
-
259
- if (address !== null) {
260
- eventData['address'] = address;
261
- }
262
-
263
- return eventData;
264
262
  }
265
263
 
266
264
  private trackProvider(provider: EIP1193Provider) {
@@ -292,7 +290,7 @@ export class FormoAnalytics implements IFormoAnalytics {
292
290
  }
293
291
 
294
292
  private async getAndStoreConnectedAddress(): Promise<string | null> {
295
- console.warn(
293
+ console.log(
296
294
  'Session data missing. Attempting to fetch address from provider.'
297
295
  );
298
296
  try {
@@ -310,7 +308,7 @@ export class FormoAnalytics implements IFormoAnalytics {
310
308
 
311
309
  private async getCurrentWallet() {
312
310
  if (!this.provider) {
313
- console.warn('FormoAnalytics::getCurrentWallet: the provider is not set');
311
+ console.log('FormoAnalytics::getCurrentWallet: the provider is not set');
314
312
  return;
315
313
  }
316
314
 
@@ -321,7 +319,7 @@ export class FormoAnalytics implements IFormoAnalytics {
321
319
  }
322
320
 
323
321
  const parsedData = JSON.parse(sessionData);
324
- const sessionExpiry = 30 * 60 * 1000; // 30 minutes
322
+ const sessionExpiry = 30 * 60 * 1000; // 30 minutesNo
325
323
  const currentTime = Date.now();
326
324
 
327
325
  if (currentTime - parsedData.timestamp > sessionExpiry) {
@@ -29,7 +29,7 @@ export const FormoAnalyticsProvider = ({
29
29
  useEffect(() => {
30
30
  const initialize = async () => {
31
31
  if (!apiKey) {
32
- console.error('FormoAnalyticsProvider: No API key provided');
32
+ console.warn('FormoAnalyticsProvider: No API key provided');
33
33
  return;
34
34
  }
35
35
  if (disabled) {