0.9.0 • Published 4 years ago

gigz-tracking v0.9.0

Weekly downloads
1
License
ISC
Repository
github
Last release
4 years ago

gigz-tracking

Tracking library for Gigz

Installation

npm install --save gigz-tracking

Setup

In your app initialization

import gigz from 'gigz-tracking';

// Use the following if you have a token based access
gigz.initToken("YOUR-TOKEN");

// OR

// Use the following if you have a proxy based access
await gigz.initProxy("YOUR-GET-TOKEN-URL", "YOUR-CHECK-TOKEN-URL{0}"); // The {0} will be replaced by the token to check

Then you can track any action with the following code

gigz.track("My first action");
gigz.track("My second action", { event_gigz_id: "XXX" });

Use the following when a user successfully authentifies on your website

gigz.engage("USER_ID", "FIRSTNAME", "EMAIL", "USER_SUBSCRIPTION_TIME");

And the following when the user signs out

gigz.reset();

Usage via a CDN

<script src="https://cdn.jsdelivr.net/npm/gigz-tracking@latest/dist/gigz.umd.min.js"></script>
<script>
	gigz.initToken("YOUR-TOKEN");
	gigz.track("My first action");
</script>

Use properties

Properties are custom parameter that you can associate with logs, in order to improve segmentation. You can pass any properties, as following:

gigz.track("A custom log", { custom_parameter: "AAA", another_parameter: "BBB" });

Improve the user location

By default, the users location will be determined based on the user IP. This method is not very accurate, so if you want to improve the user location, you can use the Geolocation API to specify the current user location to the library.

if (navigator && navigator.geolocation) {
	navigator.geolocation.getCurrentPosition(
		position => gigz.setUserLocation(position.coords.latitude, position.coords.longitude),
		err => { }
	);

	navigator.geolocation.watchPosition(position => gigz.setUserLocation(position.coords.latitude, position.coords.longitude));
}

GDPR

You can display a predefined GDPR popup with the following code:

gigz.getGdprAuthorizations(consentData => {
	// Whatever you need to do with the user consent
});

The GDPR popup will open only the first time. After that, the authorizations will be stored in cookies in order to avoid asking the user permissions again. The consent data is structured as defined in the Transparency and Consent Framework

0.9.0

4 years ago

0.8.0-beta.1

4 years ago

0.8.0-beta.0

4 years ago

0.8.2

4 years ago

0.8.1

4 years ago

0.8.0

4 years ago

0.7.2

5 years ago

0.7.1

5 years ago

0.7.0

5 years ago

0.7.0-beta.0

5 years ago

0.6.1

5 years ago

0.6.1-beta.1

5 years ago

0.6.1-beta.0

5 years ago

0.6.0

5 years ago

0.5.4

5 years ago

0.5.3

5 years ago

0.5.2

5 years ago

0.5.1

5 years ago

0.5.0

5 years ago

0.4.2

5 years ago

0.4.1

5 years ago

0.4.0

5 years ago

0.3.0

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago