Code Monkey home page Code Monkey logo

ember-cli-google-analytics's People

Contributors

ember-tomster avatar givanse avatar jsteenbeeke avatar kylenathan avatar patrickberkeley avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ember-cli-google-analytics's Issues

Allow analytics to be sent when running on localhost

When running in development or test modes it would be cool if the ga object was created with cookie domain set to none

ga('create', 'UA-XXXX-Y', { 'cookieDomain': 'none' });

This would allow testing when running on localhost

Unreliable pageview tracking

At the moment this plugin only explicitly tracks the initial pageview/transition event on app boot. It then relies on GA to try deduce later transitions automatically. From trying it out this seems to be very unreliable.

Solution is to manually track the transitions by adding an observer to your router. E.g:

var Router = Ember.Router.extend({
    location: config.locationType,
    pageviewToGA: function() {
        return ga('send', 'pageview', {
            'page': this.get('url'),
            'title': this.get('url')
        }
    }.on('didTransition')
});

But if you add this you end up with a duplicate initial pageview event (one send from html code injection from the addon, and one from the router transition).

Add configuration object to ga('send')?

Is this possible to add a configuration object to the GA tracker??

We track multiple apps and need tofilter the data per app like below:

ga('send', 'screenview', {
  'appName': 'myAppName',
  'appId': 'myAppId',
  'appVersion': '1.0',
  'appInstallerId': 'myInstallerId',
  'screenName': 'my overridden screen name'
});

More details https://developers.google.com/analytics/devguides/collection/analyticsjs/screens

Is this possible?

PS: love your package, integrates nicely.

Default config not set

When updating to v1.3.0, if ENV.googleAnalytics.tracker is not specified it won't trigger pageviews.

Fix:

ENV.googleAnalytics = {
      webPropertyId: 'UA-XXXXXXXX-1',
      tracker : 'analytics.js'
 }

Content-Security-Policy Warnings

As noted in the README, this addon uses contentFor to inject a <script>...</script> into the HTML. Content-Security-Policy v2 requires all such tags have a cryptographic signature. See https://www.w3.org/TR/2015/CR-CSP2-20150721/#script-src-hash-usage

Would it be possible to do one of the following?

  1. Move the setup code into a generated module in vendor.js or its own google-analytics.js.
  2. In the config callback, modify config.contentSecurityPolicy['script-src'] (if it exists), adding the signature.

The second option requires adding a dependency on a crypto library (build-time concern, not in the generated JS).

In either case, you could move the configuration (UA-XXXX-Y) into a <meta> tag in the HTML and pull it off there in the JS.

See also rwjblue/ember-cli-content-security-policy#67

It is not working for me Ember v2.4.0, Ember-CLI v1.13.12

The event didTransition is never called.

If I change this code:

# mixins/google-pageview.js
export default Ember.Mixin.create({

for this:

# mixins/google-pageview.js
Ember.Router.reopen({

The event didTransition is starting to been called. But now the parameters page and title are undefined.

Handle sensitive URLs

Our app has information in URLs that is quite sensitive -- such as password-reset tokens, invitation tokens, and internal user IDs. We don't want to send that information to Google. I found two ways in which this information leaks: dl and dp.

I've tested this out locally, and the following seems to work about how I would expect, protecting the URLs:

// Prevent analytics.js from sending sensitive URLs in Document Location:
ga('set', 'location', document.baseURI);

router.on('didTransition', function() {
  ga('send', 'pageview', {
    // send the symbolic route name, not the full URL:
    page: '/' + this.get('currentRouteName')
  })
});

This has the side-effect of treating a view of /blog-posts/123 and /blog-posts/456 the same. I'm not sure whether everyone would agree, but for our purposes that's an advantage.

Addon places javascript above CSS code

I'm not sure if this is a quite a bug since it may not appear when bootstrapping but it appears that this plugin adds code to the 'head' instead of the 'head-footer'.

When you place code in the 'head' you are injecting it before the included CSS files which causes chrome to not be able to async download the CSS files.

See https://developers.google.com/speed/pagespeed/module/filter-css-above-scripts
https://stackoverflow.com/questions/9271276/is-the-recommendation-to-include-css-before-javascript-invalid

This error came up as a warning in google chrome page speed audit FYI.

Retiring this project in favor of @onehilltech/ember-cli-google-analytics

Hi,

I am the creator and maintainer of @onehilltech/ember-cli-google-analytics. It is part of a collection of packages from the ember-cli-google project. I have noticed that this project is no longer being actively maintained. Additionally, it does not support Google Analytics v4. This is the version that Google recommends everyone use now.

Would you consider retiring this project, and recommending people start using @onehilltech/ember-cli-google-analytics.

Just a thought.

Thanks,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.