npm install --save @withkoji/analytics
Warning
|
This package is deprecated and is included only for backwards compatibility. For new templates, use withkoji-koji-core.html. |
The @withkoji/analytics package enables you to track custom events in your Koji templates. For example, track onClick events for the links and buttons in a Koji.
To view the analytics data for your published Koji, click the Koji button and click Analytics. You will see data for your custom events along with a standard set of built-in metrics, which are calculated from the Koji’s access logs.
Tip
|
Analytics data is processed at frequent intervals throughout the day. If you are testing the custom events in a published template and you don’t see results at first, wait 10 minutes to account for data processing latency, and then check again. |
Install the package in the frontend service of your Koji project.
npm install --save @withkoji/analytics
Import the package in your application code.
import Analytics from '@withkoji/analytics';
Generates an analytics event with the specified name and data payload, if applicable.
event
– String, name of the custom event.
payload
– Object, (Optional) list of custom key-value pairs to save with the event.
Analytics.track('My Custom Event');
Analytics.track('Won game', { score: 120 });
Core package replacement modules: Analytics (frontend)