0.0.1-security • Published 2 years ago

whjr-analytics v0.0.1-security

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

Whitehat Jr analytics library!

Easy to send segment events from website. The library supported both CDN and ESM types.

CDN

Add below code inside the head tag:

  <script>
    (function(w, d){
      w.WHJR_ANALYTICS = w.WHJR_ANALYTICS || {};
      // function will auto call when whjr-analytics library loaded.
      w.onWhjrAnalyticsLoad = function() {
        WHJR_ANALYTICS.load(`${config.SEGMENT_KEY}`);
        window.WHJR_ANALYTICS.init({});
      }
      var e = d.createElement('script');
      e.async=true;
      e.src="https://sandeep-askulet.s3.amazonaws.com/whjr-analytics-latest.min.js";
      d.head.appendChild(e);
    })(window, document);
  </script>

ESM

Install the module using npm/yarn:

  npm install whjr-analytics@latest

OR

  yarn add whjr-analytics@latest

After installation import the module in your file:

  import { load, init } from 'whjr-analytics';

  load(`${config.SEGMENT_KEY}`).then(() => {
    init();
  }).catch (e) {
    console.error('library loading failed');
  }

Supported Functions:

Function NameDescriptionArgumentsSupported Version
loadTo load segment library.1.0.0
initEnable to send events.1.0.0
trackEventSend segment event.1.0.0
trackErrorSend error type events.1.0.0
trackAPISend API type event.1.0.0
trackPageViewSend page view event.1.0.0
trackUserSend user specific event.1.0.0
getAmplitudeSessionIdGet amplitude session ID.1.0.0
getSegmentAnonymousIdGet segment anonymous ID.1.0.0
setEventPropsSet common properties, which will send in every event.1.0.0
unSetEventPropsUnset common properties.1.0.0
setUserPropsSet user specific properties, which will send in every event.1.0.0
unSetUserPropsUnset user specific properties.1.0.0

Contributors

Whitehat Jr

License

ISC Whitehat Jr

47.0.0

2 years ago

1.1.0

3 years ago

45.0.0

2 years ago

46.0.0

2 years ago

4.0.0

2 years ago

0.0.1-security

2 years ago

41.0.0

2 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago