gigz

2.0.0 • Public • Published

gigz

Tracking library for Gigz

Installation

npm install --save gigz

Setup

In your app initialization

import gigz from 'gigz';

// Use the following if you have a custom DNS
gigz.init({ customApiUrl: "YOUR-CUSTOM-DNS" });

// OR

// Use the following if you have a token
gigz.init({ token: "YOUR-TOKEN" });

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@latest/dist/gigz.browser.min.js"></script>
<script>
	gigz.init({ YOUR-SETTINGS });
	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" });

Map facebook users

If you want to create Facebook segments based on your website users, you must provide your Facebook pixel id during the library initialization:

gigz.init({ YOUR-SETTINGS, facebookPixelId: "YOUR-FACEBOOK-PIXEL-ID" });

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

Readme

Keywords

none

Package Sidebar

Install

npm i gigz

Homepage

www.gigz.fr/

Weekly Downloads

3

Version

2.0.0

License

ISC

Unpacked Size

532 kB

Total Files

5

Last publish

Collaborators

  • gigz