Hello, fellow developer! This repository is officially deprecated in favor of Ember Metrics. Unfortunately, I don't work with Ember anymore and I have a lot of other priorities going on, so I can't continue to update this package. Thanks for all the help and usage over the years. Much appreciated! <3
The simple way of tracking your app or addon using:
Google Analytics using analytics.js
.
events
events API.timing
API.social
(network) API.Tealium IQ tag manager
FastBoot Ready!
For more information about this addon, please visit the Ember Tracker website.
onload
setting.For use with Ember 2.x, use version 0.5.2.
For versions less than 2.3, you'll need to install the ember-getowner-polyfill addon.
First, install the addon via:
ember install ember-tracker
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!
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.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',
},
},
};
[...]
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.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 Environment | Tealium Environment |
---|---|
development | dev |
production | prod |
all others | qa |
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.
ember install my-addon
[Longer description of how to use the addon in apps.]
ember build
For more information on using ember-cli, visit https://ember-cli.com/.