Green Analytics javascript framework for working with the [Green Analytics Project](https://green-analytics.com).
npm install green-analytics-jslogEvent and setPerson.
bash
yarn add green-analytics-js
or
npm i --save green-analytics-js
`
Documentation
$3
To get started with this framework, you will need an account on the Green Analytics Website
Once you have the framework installed and you have an account you can initialize this framework.
`typescript
initGA('')
`
To get your api-token you have to go to the following page, while being signed in.
$3
The logEvent method is made to accept various information. It takes the type of event and the event properties.
It also accepts userProperties, which will be connected to the user. This can be information like the u
`typescript
logEvent(
event: {
name: string
type: string
website?: {
url: string
}
properties?: { [key: string]: any }
},
userProperties?: {[key:string]: any}
)
`
The setPerson method is used to determine what user is performing the following events that will be logged.
`typescript
setPerson({
id: string
name?: string
email?: string
properties?: { [key: string]: any }
})
``