0.0.9 • Published 1 year ago

@insertcoinab/gwen-analytics v0.0.9

Weekly downloads
-
License
UNLICENCED
Repository
-
Last release
1 year ago

gwen-analytics

A small Plug'n'play script which automates creation of anonumous users and sends basic events such as page-visits.

How to use

To use the script a Tracking Code is needed.

The GWEN Tracking script can be used in two different ways:

  • As an inline script added to your HTML <head> section
  • As a NPM package

Inline script

To use GWEN Tracking as an inline script add the following to the <head> section of pages which you want tracked:

<script async src="https://cdn.jsdelivr.net/npm/@insertcoinab/gwen-analytics@latest/dist/index.js"></script>
<script>
;(function(a,f,g){a[f]?g():Object.defineProperty(a,f,{configurable:!0,enumerable:!0,writeable:!0,get:function(){return a["_"+f]},set:function(i){a["_"+f]=i,g()}})})(window,"GWEN",function(){
    GWEN.Analytics.init(*TRACKING_CODE*)
})

</script>

The second script is required in order to make sure that the script has loaded before initialization. Replace *TRACKING_CODE* with the tracking code from the GWEN admin page!

NPM package

To use GWEN Tracking as a NPM package in a NodeJS project simply install with your preferred package manager

Example:

npm install @insertcoinab/gwen-analytics

After installing the package initialize the script as follows:

import {Analytics} from "@insertcoinab/gwen-analytics"

await Analytics.init(*TRACKING_CODE*);

making sure to replace *TRACKING_CODE* with the tracking code of your GWEN product.

Documentation

_constructor_

Properties

trackingCode: The tracking code of your GWEN product. Can be found here as an authenticated GWEN member.

userId: (Optional) The userID of the current user. Only needed if you have an existing GWEN user that should be the one to make progress.

init

Description

Has no properties. Is used to initialize the tracking and sending of events.

identify

Properties

userId: the GWEN userId of the logged in user

Description

If you add the package to a Single Page Application and you want to identify a user after a login step use this function. This will make it so that the give userId is being used when events are sent.

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago