saasco-sdk 0.1.10 → 0.1.11
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 +12 -9
- package/index.cjs.js +12 -4
- package/index.esm.js +12 -4
- package/package.json +1 -1
- package/src/lib/analytics.d.ts +2 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
- [Privacy](#privacy)
|
|
6
6
|
- [Getting Started](#initiate-the-lib)
|
|
7
|
-
- [Automatic Page View Tracking](#automatic-page-view-tracking)
|
|
7
|
+
- [Init Automatic Page View Tracking](#init-automatic-page-view-tracking)
|
|
8
8
|
- [Tracking Events](#tracking-events)
|
|
9
9
|
- [Identifying Users](#identifying-users)
|
|
10
10
|
- [Debugging and Dev](#debugging-and-dev)
|
|
@@ -27,22 +27,25 @@ Copy your Project ID from the project settings page in Saasco:
|
|
|
27
27
|
Then import Saasco and initiate the lib with your Project ID.
|
|
28
28
|
|
|
29
29
|
```ts
|
|
30
|
-
|
|
31
30
|
// lib/saasco.ts
|
|
32
31
|
import { Saasco } from 'saasco-sdk';
|
|
33
32
|
|
|
34
|
-
|
|
35
|
-
const saasco = new Saasco({ projectId: "YOUR-PROJECT-ID" });
|
|
36
|
-
saasco.init();
|
|
37
|
-
|
|
38
|
-
export saasco;
|
|
33
|
+
export const saasco = new Saasco({ projectId: 'YOUR-PROJECT-ID' });
|
|
39
34
|
```
|
|
40
35
|
|
|
41
|
-
## Automatic Page View Tracking
|
|
36
|
+
## Init Automatic Page View Tracking
|
|
42
37
|
|
|
43
|
-
When you initial the lib
|
|
38
|
+
When you initial the lib Saasco will automatically start tracking all page views in your app. There is no other configuration. It will automatically track url changes, even for SPAs like NextJs and Vue.
|
|
44
39
|
You can also [manually track pages](https://www.notion.so/Manual-Page-Tracking-in-SPAs-2442fc7586dc4208ae8f669eb7561b1a?pvs=21) by opting our of automatic page tracking. For most use cases you don't need to do this.
|
|
45
40
|
|
|
41
|
+
```ts
|
|
42
|
+
// ./app/index
|
|
43
|
+
import saasco from './lib/saasco';
|
|
44
|
+
|
|
45
|
+
// This should be called once in your app and will start auto page tracking if you have it enabled.
|
|
46
|
+
saasco.init();
|
|
47
|
+
```
|
|
48
|
+
|
|
46
49
|
## Tracking Events
|
|
47
50
|
|
|
48
51
|
With events you can track custom actions users are taking on your site with event properties.
|
package/index.cjs.js
CHANGED
|
@@ -434,7 +434,7 @@ const timezones = {
|
|
|
434
434
|
'Asia/Calcutta': 'IN'
|
|
435
435
|
};
|
|
436
436
|
|
|
437
|
-
var version = "0.1.
|
|
437
|
+
var version = "0.1.11";
|
|
438
438
|
|
|
439
439
|
const isBrowser = typeof window !== 'undefined';
|
|
440
440
|
let userId = null;
|
|
@@ -555,13 +555,21 @@ class Saasco {
|
|
|
555
555
|
this.log('Saasco is already initialized. Please check your code to ensure that init() is not being called multiple times.');
|
|
556
556
|
return;
|
|
557
557
|
}
|
|
558
|
+
// Export Saasco to the window object for easy access and debugging
|
|
559
|
+
if (isBrowser) {
|
|
560
|
+
window.saasco = this;
|
|
561
|
+
}
|
|
558
562
|
this.log('Saasco initialized', this.config);
|
|
559
563
|
this.initiAutoPageTracking();
|
|
560
564
|
this.isInitialized = true;
|
|
561
565
|
}
|
|
562
|
-
|
|
563
|
-
this.
|
|
564
|
-
this.
|
|
566
|
+
disableDebug() {
|
|
567
|
+
this.log('Debug mode deactivated.');
|
|
568
|
+
this.config.debug = false;
|
|
569
|
+
}
|
|
570
|
+
enableDebug() {
|
|
571
|
+
this.config.debug = true;
|
|
572
|
+
this.log('Debug mode activated.');
|
|
565
573
|
}
|
|
566
574
|
/**
|
|
567
575
|
* The track method lets you record the actions your users perform.
|
package/index.esm.js
CHANGED
|
@@ -430,7 +430,7 @@ const timezones = {
|
|
|
430
430
|
'Asia/Calcutta': 'IN'
|
|
431
431
|
};
|
|
432
432
|
|
|
433
|
-
var version = "0.1.
|
|
433
|
+
var version = "0.1.11";
|
|
434
434
|
|
|
435
435
|
const isBrowser = typeof window !== 'undefined';
|
|
436
436
|
let userId = null;
|
|
@@ -551,13 +551,21 @@ class Saasco {
|
|
|
551
551
|
this.log('Saasco is already initialized. Please check your code to ensure that init() is not being called multiple times.');
|
|
552
552
|
return;
|
|
553
553
|
}
|
|
554
|
+
// Export Saasco to the window object for easy access and debugging
|
|
555
|
+
if (isBrowser) {
|
|
556
|
+
window.saasco = this;
|
|
557
|
+
}
|
|
554
558
|
this.log('Saasco initialized', this.config);
|
|
555
559
|
this.initiAutoPageTracking();
|
|
556
560
|
this.isInitialized = true;
|
|
557
561
|
}
|
|
558
|
-
|
|
559
|
-
this.
|
|
560
|
-
this.
|
|
562
|
+
disableDebug() {
|
|
563
|
+
this.log('Debug mode deactivated.');
|
|
564
|
+
this.config.debug = false;
|
|
565
|
+
}
|
|
566
|
+
enableDebug() {
|
|
567
|
+
this.config.debug = true;
|
|
568
|
+
this.log('Debug mode activated.');
|
|
561
569
|
}
|
|
562
570
|
/**
|
|
563
571
|
* The track method lets you record the actions your users perform.
|
package/package.json
CHANGED
package/src/lib/analytics.d.ts
CHANGED
|
@@ -24,7 +24,8 @@ export declare class Saasco {
|
|
|
24
24
|
debug?: boolean;
|
|
25
25
|
});
|
|
26
26
|
init(): void;
|
|
27
|
-
|
|
27
|
+
disableDebug(): void;
|
|
28
|
+
enableDebug(): void;
|
|
28
29
|
/**
|
|
29
30
|
* The track method lets you record the actions your users perform.
|
|
30
31
|
* Its good to keep a conistent naming convention for your events.
|