@armco/analytics 0.1.4 → 0.1.6

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/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
- init();
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,3 +1,4 @@
1
+ import { init, identify, getEnvironment, getEnvironmentType, trackEvent, trackPageView, trackError, enableTracking, generateAnonymousId, sendHostProjectName, getSessionId, startSession } from "./dist";
1
2
  import main from "./dist";
2
3
 
3
4
  export interface User {
@@ -31,4 +32,6 @@ export type SubmissionStrategy = "ONEVENT" | "DEFER"
31
32
  export type objType = { [key: string]: any }
32
33
  export type EVENT_TYPES = "CLICK" | "SUBMIT" | "SCROLL" | string
33
34
 
35
+ export { init, identify, getEnvironment, getEnvironmentType, trackEvent, trackPageView, trackError, enableTracking, generateAnonymousId, sendHostProjectName, getSessionId, startSession, };
34
36
  export default main;
37
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@armco/analytics",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "Browser Based Analytics interceptor for configured events",
5
5
  "main": "index.js",
6
6
  "type": "module",