tvjs-google-analytics

1.0.1 • Public • Published

ES6 Google Analytics for Apple's tvOS TVMLKit JS Runtime

This library provides Google Analytics support for Apple's tvOS TVMLKit JavaScript runtime. It uses the Google Analytics Measurement Protocol to provide a mobile SDK like API to track analytics events and screenviews within the tvOS Client/Server application.

Example

First, initialize the library.

let ga = new GoogleAnalytics("YOUR_TRACKING_ID", "YOUR_APP_NAME");

Then, in your TVML documents onload handler:

<document onload="ga.screenview('YOUR_SCREEN_NAME');">
    ...
</document>

And, in your event handlers:

function mySelectHandler(event) {
    ga.event("YOUR_CATEGORY", "YOUR_ACTION"); 
}

Contributions

Contributions to support testing and additional event types are welcome.

Credits

Heavily inspired by Doug Richardson's prior art. https://github.com/drichardson/tvjs_google_analytics

Package Sidebar

Install

npm i tvjs-google-analytics

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

10.2 kB

Total Files

4

Last publish

Collaborators

  • nadavoid
  • grshane
  • dmuzyka
  • mkochendorfer
  • pschuelke
  • yuginaili
  • cclarkdev
  • febbraro
  • himerus