New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ember-tracker

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-tracker

Easily add Google Analytics page and event tracking to your Ember JS Application.

  • 0.5.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
19
increased by280%
Maintainers
1
Weekly downloads
 
Created
Source

ember-tracker

Build Status NPM Ember Observer Score

The simple way of tracking your app or addon using:

Google Analytics using analytics.js.

  • Pageviews - Every transition will be captured and sent as a page view!
  • Events - Track what your users are doing by using the events events API.
  • User Timing - Gague performance with the timing API.
  • Social - Track shares, tweets, etc with the social (network) API.
  • Custom page/titles and "before analytics" callback.

Tealium IQ tag manager

  • Support for dev, qa and production environments out-of-the-box.

FastBoot Ready!

For more information about this addon, please visit the Ember Tracker website.

Minimum Requirements

  • Ember 2.3+
  • Ember CLI
  • IE9+ (When using the Tealium mixin with the onload setting.

For versions lower than 2.3, you'll need to install the ember-getowner-polyfill addon.

Setup

First, install the addon via:

ember install ember-tracker

Configuring Google Analytics

After you've installed the addon, open your config file located in config/environment.js. Next, add a new object to the ENV variable called emberTracker. Finally, add an object on it called analyticsSettings with your trackingId. Your config should look something similar to:

[...]
module.exports = function(environment) {
	var ENV = {
		[...]
		APP: {
			// Here you can pass flags/options to your application instance
			// when it is created
		},
		emberTracker: {
			analyticsSettings: {
				trackingId: 'UA-########-#',
			},
		},
	};
[...]

Feel free to change your trackingId based on the environment you're in.

Now, you can add the GoogleAnalyticsRoute mixin to your Router to start tracking pageviews and inject the service into your controllers/components. Learn how!

Options

There are three options available for Google Analytics you may want to use in your environment.js file. They are:

  • LOG_PAGEVIEW (boolean) - Logs all pageview events to the console.
  • LOG_EVENTS (boolean) - Logs all event, timing and network (social) requests to the console.
  • onload (boolean) - Lazy loads Google Analytics after the window.onload function fires.
  • createOptions (object) - This will get JSON.stringify encoded and passed to the create object as the last parameter.
  • afterCreate (string) - Appended to the JavaScript after the call to ga('create', 'UA-####');. Use this to run JavaScript after the "create" function, such as Optimizely's "activeUniversalAnalytics" call. Although this is a string, yit must represent valid JavaScript.

Configuring Tealium IQ

To allow Tealium, simply open the config/environment.js file and add a new object to the ENV variable called emberTracker. Finally, add an object called tealiumSettings with a your accountName as an additional property. Your config should look something similar to:

[...]
module.exports = function(environment) {
	var ENV = {
		[...]
		APP: {
			// Here you can pass flags/options to your application instance
			// when it is created
		},
		emberTracker: {
			tealiumSettings: {
				accountName: 'myAccName',
			},
		},
	};
[...]

Options

There is one option available for Tealium you may wish to use in your environment.js file. It is:

  • onload (boolean) - Loads Tealium after the window.onload event fires. It uses addEventListener which requires >= IE9.

Notes

That's it! The addon will take care of using the dev, qa or production environments for you. For reference, it determines which environment to use in Tealium based on the following conditions:

You're now ready to add the TealiumRoute mixin to your Router to start updating Tealium on new routes. Learn how!

Ember EnvironmentTealium Environment
developmentdev
productionprod
all othersqa

Additional Reading

I've put together more documentation on the ember-tracker website on how to use both the Google Analytics services as well as updating Tealium during route transitions.

Addon Maintenance

Installation

  • git clone <repository-url> this repository
  • cd ember-tracker
  • npm install
  • bower install

Running

Running Tests

  • npm test (Runs ember try:each to test your addon against multiple Ember versions)
  • ember test
  • ember test --server

Building

  • ember build

For more information on using ember-cli, visit https://ember-cli.com/.

Keywords

FAQs

Package last updated on 08 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc