@umbrellio/ga-tracker
v0.3.1
Published
Google Analytics tracker
Downloads
8
Readme
@umbrellio/ga-tracker
Google Analytics tracker for web env (no window
object required).
Install
$ yarn add @umbrellio/ga-tracker
Usage
import GATracker from "@umbrellio/ga-tracker"
const tracker = GATracker.create(trackingId)
tracker.pageview({ dp: "/contacts", dt: "Contacts" })
Where trackingId
is your app tracking id (like UA-XXXXXXXXX-X
).
Available methods:
set(key, value)
– set any global var (like user params)pageview({ dl, dh, dp, dt })
– track page viewing (Docs)timing({ utc, utv, utt, utl })
– track custom timings (Docs)
Errors
NetworkError
import GATracker from "@umbrellio/ga-tracker"
GATracker.Errors.NetworkError
Throws when there was an error while sending a http request.
ConnectionError
import GATracker from "@umbrellio/ga-tracker"
GATracker.Errors.ConnectionError
Throws when unable to send a http request.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/umbrellio/ga-tracker.
License
Released under MIT License.
Authors
Created by Aleksei Bespalov,