aesirx-analytics 2.3.6 → 2.4.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/README.md +2 -242
- package/dist/analytics.js +1 -23686
- package/dist/index.d.ts +5 -40
- package/dist/index.js +515 -432
- package/package.json +2 -16
- package/dist/Consent-A2R6PCLK.js +0 -803
- package/dist/ConsentCustom-LYMWYNRI.js +0 -1160
- package/dist/chunk-NKOHXSTE.js +0 -2510
- package/dist/chunk-UJC5773H.js +0 -11357
package/README.md
CHANGED
@@ -4,6 +4,8 @@ A powerful and compliant web Analytics platform (1st-party alternative to Google
|
|
4
4
|
|
5
5
|
AesirX Analytics comes with a locally hosted JavaScript solution that gathers and stores data legally and compliantly in accordance with GDPR and other regional legislation including storage of citizens’ data in-country and 1st-party.
|
6
6
|
|
7
|
+
*Important Change: AesirX Consent was split to another packages https://github.com/aesirxio/consent
|
8
|
+
|
7
9
|
## Setup instructions
|
8
10
|
|
9
11
|
### Setup the 1st party server
|
@@ -21,22 +23,11 @@ Follow the instructions in: [https://github.com/aesirxio/analytics-1stparty](htt
|
|
21
23
|
```
|
22
24
|
<script>
|
23
25
|
window.aesirx1stparty = "https://example.com"
|
24
|
-
window.aesirxClientID="[REPLACE THIS WITH THE PROVIDED CLIENT_ID]"
|
25
|
-
window.aesirxClientSecret="[REPLACE THIS WITH THE PROVIDED CLIENT_SECRET]"
|
26
26
|
</script>
|
27
27
|
<script async defer src="YOUR_PROJECT_PATH/analytics.js"></script>
|
28
28
|
```
|
29
29
|
|
30
30
|
1. (`https://example.com` is the link to your 1st party server which must be installed)
|
31
|
-
2. `CLIENT_ID` replace this with the provided `CLIENT_ID` from https://dapp.shield.aesirx.io/
|
32
|
-
3. `CLIENT_SECRET` replace this with the provided `CLIENT_SECRET` fromhttps://dapp.shield.aesirx.io/
|
33
|
-
|
34
|
-
##### Disable Consent Popup:
|
35
|
-
```
|
36
|
-
<script>
|
37
|
-
window.disableAnalyticsConsent = "true"
|
38
|
-
</script>
|
39
|
-
```
|
40
31
|
|
41
32
|
#### Usage in ReactJS
|
42
33
|
|
@@ -46,18 +37,8 @@ Follow the instructions in: [https://github.com/aesirxio/analytics-1stparty](htt
|
|
46
37
|
|
47
38
|
```
|
48
39
|
REACT_APP_ENDPOINT_ANALYTICS_URL=https://example.com
|
49
|
-
REACT_APP_SSO_CLIENT_ID=[REPLACE THIS WITH THE PROVIDED CLIENT_ID]
|
50
|
-
REACT_APP_SSO_CLIENT_SECRET=[REPLACE THIS WITH THE PROVIDED CLIENT_SECRET]
|
51
40
|
|
52
41
|
(https://example.com is the link to your 1st party server)
|
53
|
-
`CLIENT_ID` replace this with the provided `CLIENT_ID` from https://dapp.shield.aesirx.io/
|
54
|
-
`CLIENT_SECRET` replace this with the provided `CLIENT_SECRET` fromhttps://dapp.shield.aesirx.io/
|
55
|
-
```
|
56
|
-
|
57
|
-
##### Disable Consent Popup:
|
58
|
-
add this environment variable to `.env`
|
59
|
-
```
|
60
|
-
REACT_APP_DISABLE_ANALYTICS_CONSENT=true
|
61
42
|
```
|
62
43
|
|
63
44
|
###### With react-router-dom v5:
|
@@ -89,12 +70,8 @@ export default AnalyticsContainer;
|
|
89
70
|
|
90
71
|
```
|
91
72
|
NEXT_PUBLIC_ENDPOINT_ANALYTICS_URL=https://example.com
|
92
|
-
NEXT_PUBLIC_SSO_CLIENT_ID=[REPLACE THIS WITH THE PROVIDED CLIENT_ID]
|
93
|
-
NEXT_PUBLIC_SSO_CLIENT_SECRET=[REPLACE THIS WITH THE PROVIDED CLIENT_SECRET]
|
94
73
|
|
95
74
|
(https://example.com is the link to your 1st party server)
|
96
|
-
`CLIENT_ID` replace this with the provided `CLIENT_ID` from https://dapp.shield.aesirx.io/
|
97
|
-
`CLIENT_SECRET` replace this with the provided `CLIENT_SECRET` fromhttps://dapp.shield.aesirx.io/
|
98
75
|
```
|
99
76
|
|
100
77
|
##### Disable Consent Popup:
|
@@ -239,220 +216,3 @@ const CustomEvent = () => {
|
|
239
216
|
(`endPoint` is the link to your 1st party server which must be installed)
|
240
217
|
|
241
218
|
(`referer` is the referer domain)
|
242
|
-
|
243
|
-
## Customize CSS for Consent modal
|
244
|
-
Please follow below CSS example:
|
245
|
-
```
|
246
|
-
// Customize toast
|
247
|
-
.aesirxconsent .toast {
|
248
|
-
--aesirxconsent-toast-font-size: 16px;
|
249
|
-
--aesirxconsent-toast-padding-x: 0.75rem;
|
250
|
-
--aesirxconsent-toast-padding-y: 0.5rem;
|
251
|
-
--aesirxconsent-toast-spacing: 1.5rem;
|
252
|
-
--aesirxconsent-toast-zindex: 1049;
|
253
|
-
}
|
254
|
-
// Customize button
|
255
|
-
.aesirxconsent .btn {
|
256
|
-
--aesirxconsent-btn-font-size: 16px;
|
257
|
-
--aesirxconsent-btn-padding-x: 0.75rem;
|
258
|
-
--aesirxconsent-btn-padding-y: 0.375rem;
|
259
|
-
--aesirxconsent-btn-font-weight: 400;
|
260
|
-
--aesirxconsent-btn-line-height: 1.5;
|
261
|
-
}
|
262
|
-
// Customize button success
|
263
|
-
.aesirxconsent .btn-success {
|
264
|
-
--aesirxconsent-btn-color: #000;
|
265
|
-
--aesirxconsent-btn-bg: #1ab394;
|
266
|
-
--aesirxconsent-btn-border-color: #1ab394;
|
267
|
-
--aesirxconsent-btn-hover-color: #000;
|
268
|
-
--aesirxconsent-btn-hover-bg: #3cbea4;
|
269
|
-
--aesirxconsent-btn-hover-border-color: #31bb9f;
|
270
|
-
--aesirxconsent-btn-focus-shadow-rgb: 22, 152, 126;
|
271
|
-
--aesirxconsent-btn-active-color: #000;
|
272
|
-
--aesirxconsent-btn-active-bg: #48c2a9;
|
273
|
-
--aesirxconsent-btn-active-border-color: #31bb9f;
|
274
|
-
--aesirxconsent-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
|
275
|
-
--aesirxconsent-btn-disabled-color: #000;
|
276
|
-
--aesirxconsent-btn-disabled-bg: #1ab394;
|
277
|
-
--aesirxconsent-btn-disabled-border-color: #1ab394;
|
278
|
-
}
|
279
|
-
// To customize CSS for dark mode (Bootstrap dark mode)
|
280
|
-
[data-bs-theme=dark] .aesirxconsent {
|
281
|
-
color: #fff;
|
282
|
-
}
|
283
|
-
```
|
284
|
-
|
285
|
-
|
286
|
-
## Choose template for Consent modal
|
287
|
-
|
288
|
-
There is 5 template for Consent modal
|
289
|
-
1. default (recommend)
|
290
|
-
1. Support Advance Consent Mode v2
|
291
|
-
2. simple-consent-mode
|
292
|
-
1. Support Basic Consent Mode v2
|
293
|
-
|
294
|
-
#### Usage in SSR site:
|
295
|
-
```
|
296
|
-
<script>
|
297
|
-
window.consentLayout = "default"
|
298
|
-
</script>
|
299
|
-
```
|
300
|
-
|
301
|
-
#### In ReactJS:
|
302
|
-
|
303
|
-
add this environment variable to `.env`
|
304
|
-
```
|
305
|
-
REACT_APP_CONSENT_LAYOUT=default
|
306
|
-
```
|
307
|
-
|
308
|
-
#### In NextJS:
|
309
|
-
|
310
|
-
add this environment variable to `.env`
|
311
|
-
```
|
312
|
-
NEXT_PUBLIC_CONSENT_LAYOUT=default
|
313
|
-
```
|
314
|
-
|
315
|
-
## Opt-in Consent
|
316
|
-
|
317
|
-
#### Usage in SSR site:
|
318
|
-
```
|
319
|
-
<script>
|
320
|
-
window.optInConsentData = `[
|
321
|
-
{
|
322
|
-
"title":"payment",
|
323
|
-
"content":"<div>YOUR_CONTENT_INPUT_HERE</div>"
|
324
|
-
}
|
325
|
-
]`;
|
326
|
-
|
327
|
-
//trigger open optIn consent with Javascript
|
328
|
-
document.querySelector('.opt-in-consent.payment').classList.add('show');
|
329
|
-
</script>
|
330
|
-
```
|
331
|
-
|
332
|
-
(We also provive option `replaceAnalyticsConsent` to replace Analytics Consent with Opt-in Consent)
|
333
|
-
```
|
334
|
-
<script>
|
335
|
-
window.optInConsentData = `[
|
336
|
-
{
|
337
|
-
"title":"payment",
|
338
|
-
"content":"<div>YOUR_CONTENT_INPUT_HERE</div>",
|
339
|
-
"replaceAnalyticsConsent": "true"
|
340
|
-
}
|
341
|
-
]`
|
342
|
-
</script>
|
343
|
-
```
|
344
|
-
|
345
|
-
#### In ReactJS:
|
346
|
-
```
|
347
|
-
const OptInConsent = React.lazy(
|
348
|
-
() => import('./OptInConsent').then(module => ({ default: module.OptInConsent }))
|
349
|
-
);
|
350
|
-
const ConsentComponent = () => {
|
351
|
-
const [showModal, setShowModal] = useState(false);
|
352
|
-
const handleOpen = () => {
|
353
|
-
setShowModal(true);
|
354
|
-
};
|
355
|
-
const handleConsent = () => {
|
356
|
-
setShowModal(false);
|
357
|
-
};
|
358
|
-
const handleReject = () => {
|
359
|
-
setShowModal(false);
|
360
|
-
};
|
361
|
-
return (
|
362
|
-
<>
|
363
|
-
<OptInConsent
|
364
|
-
optInConsentData={[
|
365
|
-
{
|
366
|
-
title: 'payment',
|
367
|
-
content: `<div>YOUR_CONTENT_INPUT_HERE</div>`,
|
368
|
-
show: showModal,
|
369
|
-
handleConsent: handleConsent,
|
370
|
-
handleReject: handleReject
|
371
|
-
},
|
372
|
-
]}
|
373
|
-
/>
|
374
|
-
</>
|
375
|
-
);
|
376
|
-
};
|
377
|
-
```
|
378
|
-
(We also provive option `replaceAnalyticsConsent` to replace Analytics Consent with Opt-in Consent)
|
379
|
-
To use this in ReactJS please add `isOptInReplaceAnalytics` to our provider first
|
380
|
-
```
|
381
|
-
<AnalyticsReact location={location} history={history} isOptInReplaceAnalytics={true}>
|
382
|
-
{children}
|
383
|
-
</AnalyticsReact>
|
384
|
-
```
|
385
|
-
```
|
386
|
-
<OptInConsent
|
387
|
-
optInConsentData={[
|
388
|
-
{
|
389
|
-
title: 'payment',
|
390
|
-
content: `<div>YOUR_CONTENT_INPUT_HERE</div>`,
|
391
|
-
show: showModal,
|
392
|
-
handleConsent: handleConsent,
|
393
|
-
handleReject: handleReject,
|
394
|
-
replaceAnalyticsConsent: "true"
|
395
|
-
},
|
396
|
-
]}
|
397
|
-
/>
|
398
|
-
```
|
399
|
-
#### In NextJS:
|
400
|
-
```
|
401
|
-
import dynamic from "next/dynamic";
|
402
|
-
const OptInConsent = dynamic(
|
403
|
-
() => import("aesirx-analytics").then((module) => module.OptInConsent),
|
404
|
-
{
|
405
|
-
loading: () => <div>Loading...</div>,
|
406
|
-
ssr: false,
|
407
|
-
}
|
408
|
-
);
|
409
|
-
|
410
|
-
const ConsentComponent = () => {
|
411
|
-
const [showModal, setShowModal] = useState(false);
|
412
|
-
const handleOpen = () => {
|
413
|
-
setShowModal(true);
|
414
|
-
};
|
415
|
-
const handleConsent = () => {
|
416
|
-
setShowModal(false);
|
417
|
-
};
|
418
|
-
const handleReject = () => {
|
419
|
-
setShowModal(false);
|
420
|
-
};
|
421
|
-
return (
|
422
|
-
<>
|
423
|
-
<OptInConsent
|
424
|
-
optInConsentData={[
|
425
|
-
{
|
426
|
-
title: 'payment',
|
427
|
-
content: `<div>YOUR_CONTENT_INPUT_HERE</div>`,
|
428
|
-
show: showModal,
|
429
|
-
handleConsent: handleConsent,
|
430
|
-
handleReject: handleReject
|
431
|
-
},
|
432
|
-
]}
|
433
|
-
/>
|
434
|
-
</>
|
435
|
-
);
|
436
|
-
};
|
437
|
-
```
|
438
|
-
(We also provive option `replaceAnalyticsConsent` to replace Analytics Consent with Opt-in Consent)
|
439
|
-
To use this in NextJS please add `isOptInReplaceAnalytics` to our provider first
|
440
|
-
```
|
441
|
-
<AnalyticsNext router={useRouter()} isOptInReplaceAnalytics={true}>
|
442
|
-
<[YOUR-COMPONENT]/>
|
443
|
-
</AnalyticsNext>
|
444
|
-
```
|
445
|
-
```
|
446
|
-
<OptInConsent
|
447
|
-
optInConsentData={[
|
448
|
-
{
|
449
|
-
title: 'payment',
|
450
|
-
content: `<div>YOUR_CONTENT_INPUT_HERE</div>`,
|
451
|
-
show: showModal,
|
452
|
-
handleConsent: handleConsent,
|
453
|
-
handleReject: handleReject,
|
454
|
-
replaceAnalyticsConsent: "true"
|
455
|
-
},
|
456
|
-
]}
|
457
|
-
/>
|
458
|
-
```
|