@plattar/plattar-analytics
v1.152.2
Published
Plattar Analytics for querying and writing analytics data
Downloads
534
Maintainers
Readme
plattar-analytics allows reading, querying and writing analytics data to plattar backend services.
Quick Use
- ES2015 & ES2019 Builds via jsDelivr
// Minified Version ES2015 & ES2019 (Latest)
https://cdn.jsdelivr.net/npm/@plattar/plattar-analytics/build/es2015/plattar-analytics.min.js
https://cdn.jsdelivr.net/npm/@plattar/plattar-analytics/build/es2019/plattar-analytics.min.js
// Standard Version ES2015 & ES2019 (Latest)
https://cdn.jsdelivr.net/npm/@plattar/plattar-analytics/build/es2015/plattar-analytics.js
https://cdn.jsdelivr.net/npm/@plattar/plattar-analytics/build/es2019/plattar-analytics.js
Installation
- Install using npm
npm install @plattar/plattar-analytics
Analytics Query Example
// create a new Analytics instance for a particular application
const analytics = new PlattarAnalytics.Analytics("your-application-id");
// default is production, can be production, staging or dev
analytics.origin = "production";
// default is track, can be track or pageview
analytics.event = "track";
// your analytics query
const query = {
// create the analytics query JSON
}
// send the query
analytics.query(query).then((results) => {
// do something with results. Results structure varies based on query
console.log(results);
}).catch((err) => {
console.error(err);
});