@blotoutio/edgetag-sdk-js 0.5.0 → 0.5.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/index.cjs CHANGED
@@ -453,16 +453,20 @@ const handleInit = preferences => {
453
453
  return;
454
454
  }
455
455
 
456
- let url = `${getInitURL()}`;
456
+ const url = new URL(getInitURL());
457
457
 
458
458
  if (preferences.disableConsentCheck) {
459
- url = `${url}?consentDisabled=true`;
459
+ url.searchParams.set('consentDisabled', 'true');
460
460
  saveConsent({
461
461
  all: true
462
462
  });
463
463
  }
464
464
 
465
- getRequest(url).then(result => {
465
+ if (preferences.userId) {
466
+ url.searchParams.set('userId', preferences.userId);
467
+ }
468
+
469
+ getRequest(url.href).then(result => {
466
470
  if (!result) {
467
471
  console.log('init failed');
468
472
  return;
package/index.js CHANGED
@@ -449,16 +449,20 @@ const handleInit = preferences => {
449
449
  return;
450
450
  }
451
451
 
452
- let url = `${getInitURL()}`;
452
+ const url = new URL(getInitURL());
453
453
 
454
454
  if (preferences.disableConsentCheck) {
455
- url = `${url}?consentDisabled=true`;
455
+ url.searchParams.set('consentDisabled', 'true');
456
456
  saveConsent({
457
457
  all: true
458
458
  });
459
459
  }
460
460
 
461
- getRequest(url).then(result => {
461
+ if (preferences.userId) {
462
+ url.searchParams.set('userId', preferences.userId);
463
+ }
464
+
465
+ getRequest(url.href).then(result => {
462
466
  if (!result) {
463
467
  console.log('init failed');
464
468
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blotoutio/edgetag-sdk-js",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "JS SDK for EdgeTag",
5
5
  "author": "Blotout",
6
6
  "license": "MIT",
@@ -16,6 +16,7 @@ type Data = Record<string, unknown>
16
16
  interface InitPreferences {
17
17
  edgeURL: string
18
18
  disableConsentCheck?: boolean
19
+ userId?: string
19
20
  }
20
21
 
21
22
  interface EventOptions {