@applicaster/quick-brick-google-analytics

Javascript implementation of Google Analytics

Usage no npm install needed!

<script type="module">
  import applicasterQuickBrickGoogleAnalytics from 'https://cdn.skypack.dev/@applicaster/quick-brick-google-analytics';
</script>

README

Quick-Brick-Google-Analytics

npm version

This plugin configures and initializes Google Analytics for QuickBrick based projects. The plugin is based off of a library called react-ga written by the team over at the Mozilla.

When initializing Google Analytics the plugin either 'auto' configures the application using all of Google's defaults or it utilizes a custom configuration that works for projects running off the device's local file system. This configuration was designed to be used on web based platforms like Samsung and LG but it applies to any device running the static assets locally.

Configuration

Tracker ID

In order to use this plugin users are required to specify the tracker id. The format is UA-XXXX-Y. All collected data is associated by this ID.

Field Name Value Type Default Value
trackingId text None

Optional Fields

Optionally users could configure the following fields:

  • Sample rate
  • Site speed sample rate
  • Always send referrer
  • Cookie expiration

Sample Rate

Specifies what percentage of users should be tracked. This defaults to 100 (no users are sampled out) but large sites may need to use a lower sample rate to stay within Google Analytics processing limits.

Field Name Value Type Default Value
sampleRate number 100

Site Speed Sample Rate

This setting determines how often site speed beacons will be sent. By default, 1% of users will be automatically be measured.

Field Name Value Type Default Value
siteSpeedSampleRate number 1

Always Send Referrer

By default the HTTP referrer URL, which is used to attribute traffic sources, is only sent when the hostname of the referring site differs from the hostname of the current page. Enable this setting only if you want to process other pages from your current host as referrals.

Field Name Value Type Default Value
alwaysSendReferrer boolean false

Cookie Expriation

Specifies the cookie expiration, in seconds.

Field Name Value Type Default Value
cookieExpires integer 63072000 (two years)

Pre-configured Fields

The following fields are not user configurable and have been defined for the user:

  • Allow Anchor: true,
  • Cookie Name: "_ga" + bundleID,
  • Cookie Domain: "none",
  • Cookie Flags: "SameSite=None",
  • Allow Linker: true,

For additional information please refer to Google Analytics docs here

Events

At the moment we are sending the following events from TV Platforms:

  • Launch App
  • Home screen: Viewed
  • Tap Cell
  • VOD Item: Play Was Triggered
  • Play VOD Item
  • Channel Item: Play Was Triggered
  • Program Item: Play Was Triggered