@armco/analytics 0.1.3 → 0.1.5
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/dist/analytics.d.ts +1 -9
- package/dist/index.d.ts +2 -2
- package/dist/index.js +11 -3
- package/index.d.ts +16 -6
- package/package.json +1 -1
package/dist/analytics.d.ts
CHANGED
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
import { startSession, getSessionId } from "./session";
|
|
2
|
-
import { User, Event,
|
|
3
|
-
interface ConfigType {
|
|
4
|
-
apiKey?: string;
|
|
5
|
-
analyticsEndpoint?: string;
|
|
6
|
-
hostProjectName?: string;
|
|
7
|
-
trackEvents?: Array<string>;
|
|
8
|
-
submissionStrategy?: SubmissionStrategy;
|
|
9
|
-
showPopUp?: boolean;
|
|
10
|
-
}
|
|
2
|
+
import { User, Event, ConfigType } from "./index.d";
|
|
11
3
|
declare let enabled: boolean | null;
|
|
12
4
|
declare function loadConfiguration(): Promise<any>;
|
|
13
5
|
declare function getEnvironment(): string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { init, identify, getEnvironmentType, trackEvent, trackPageView, trackError, enableTracking, generateAnonymousId, sendHostProjectName, getSessionId, startSession } from "./analytics";
|
|
2
|
-
export { init, identify, getEnvironmentType, trackEvent, trackPageView, trackError, enableTracking, generateAnonymousId, sendHostProjectName, getSessionId, startSession, };
|
|
1
|
+
import { init, identify, getEnvironment, getEnvironmentType, trackEvent, trackPageView, trackError, enableTracking, generateAnonymousId, sendHostProjectName, getSessionId, startSession } from "./analytics";
|
|
2
|
+
export { init, identify, getEnvironment, getEnvironmentType, trackEvent, trackPageView, trackError, enableTracking, generateAnonymousId, sendHostProjectName, getSessionId, startSession, };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
import { init, identify, getEnvironmentType, trackEvent, trackPageView, trackError, enableTracking, generateAnonymousId, sendHostProjectName, getSessionId, startSession, } from "./analytics";
|
|
1
|
+
import { init, identify, getEnvironment, getEnvironmentType, trackEvent, trackPageView, trackError, enableTracking, generateAnonymousId, sendHostProjectName, getSessionId, startSession, } from "./analytics";
|
|
2
2
|
document.addEventListener("DOMContentLoaded", function (event) {
|
|
3
|
-
|
|
3
|
+
const environment = getEnvironment();
|
|
4
|
+
console.info("[ANALYTICS] Idenfitied environment: ", environment);
|
|
5
|
+
if (!environment || environment === "development") {
|
|
6
|
+
console.info("[ANALYTICS] Attempting to auto-load analytics configurations from environment...");
|
|
7
|
+
init();
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
console.info("[ANALYTICS] Identified non-dev environment, analytics auto load wouldn't be attempted.");
|
|
11
|
+
}
|
|
4
12
|
});
|
|
5
|
-
export { init, identify, getEnvironmentType, trackEvent, trackPageView, trackError, enableTracking, generateAnonymousId, sendHostProjectName, getSessionId, startSession, };
|
|
13
|
+
export { init, identify, getEnvironment, getEnvironmentType, trackEvent, trackPageView, trackError, enableTracking, generateAnonymousId, sendHostProjectName, getSessionId, startSession, };
|
package/index.d.ts
CHANGED
|
@@ -1,24 +1,34 @@
|
|
|
1
1
|
import main from "./dist";
|
|
2
2
|
|
|
3
3
|
export interface User {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
email: string;
|
|
5
|
+
// Other user properties...
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
export interface Event {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
eventType: string;
|
|
10
|
+
timestamp?: Date;
|
|
11
11
|
region?: string,
|
|
12
12
|
address?: string,
|
|
13
13
|
coordinates?: {
|
|
14
14
|
latitude: number
|
|
15
15
|
longitude: number
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
[key: string]: any; // Index signature to accept any other properties with their associated types
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
export type SubmissionStrategy = "ONEVENT" | "DEFER"
|
|
21
20
|
|
|
21
|
+
export interface ConfigType {
|
|
22
|
+
apiKey?: string;
|
|
23
|
+
analyticsEndpoint?: string;
|
|
24
|
+
hostProjectName?: string;
|
|
25
|
+
trackEvents?: Array<string>;
|
|
26
|
+
submissionStrategy?: SubmissionStrategy
|
|
27
|
+
showPopUp?: boolean
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export type SubmissionStrategy = "ONEVENT" | "DEFER"
|
|
31
|
+
export type objType = { [key: string]: any }
|
|
22
32
|
export type EVENT_TYPES = "CLICK" | "SUBMIT" | "SCROLL" | string
|
|
23
33
|
|
|
24
34
|
export default main;
|