Code Monkey home page Code Monkey logo

autotrack's People

Contributors

brentmclark avatar coliff avatar cycomachead avatar diminishedprime avatar dirtyf avatar finaiized avatar johnbacon avatar kevinjalbert avatar krisu7 avatar niaomingjian avatar pfrisella avatar philipwalton avatar pscheit avatar shilongzhuang avatar youngilcho 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  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  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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

autotrack's Issues

Safari/Mac opens all links in new tabs

When using autotrack.js 0.6.5, Safari-Mac (not iOS) opens all external links in a new tab - other browsers behave correctly. Since i'm not a developer, I do only note that issue here.

Is this ready for primetime?

Is this library stable enough to be used on a large-ish publishing site in production? Would be useful to test it - but I don't want to have any potential issues with causing errors in our tracking. We currently use Tag manager for most interactions

Real-time analytics numbers are around ~10% when this script is active

We've tried deploying this script a few times to our site and have seen the GA real-time tab numbers drop to around 10% of their numbers. As soon as we remove the script, the numbers jump back up.

Is there a setting to get this script to behave correctly with real-time analytics reporting?

Sending pageview after enhanced ecommerce

In the enhanced ecommerce documentation is shows sending the page view after sending the data however when using autotrack the pageview is always sent first. I could always send a pageview after my data but I'm assuming that would create a duplicate pageview hit in the stats.

Adding click source to Outbound Link

I just successfully added autotrack to my site (thanks to the help in #68!) but it doesn't seem like the page source gets recorded. I'm not 100% sure yet as I'm only able to see the realtime data, but I assume it's not. This small piece of information would be more or less crucial.

In outbound-link-tracker.js there's the following code:

this.tracker.send('event', 'Outbound Link', 'click', link.href, { transport: 'beacon' });

What I'm looking for is to change it to something like this:

this.tracker.send('event', 'Outbound Link', location.href, link.href, { transport: 'beacon' });

Is this possible somehow?

How does urlChangeTracker work?

First of all, thanks for the great library. I like how easy is to implement it with Browserify.

I'd like to ask how exactly urlChangeTracker works - we'd like to use it for tracking overlays as additional pageviews, eg. /team/#name. So in the overlay code we are using History API and have something like:

history.pushState({type: "overlay", url: id}, document.title, url + "#" + id);

But it doesn't seem to generate additional pageviews. Is the problem that only hash portion of the URL changes as mentioned in documentation? I guess so just wanted be sure before messing with URL rewriting.

Thanks

Outbound Link Tracking For Browsers That Don't Support Beacons

This is more of a feature/suggestion than a bug.

I understand why browsers that don't support beacons currently open links in a new tab but I think it would be good to include some additional alternative methods for those who dislike the current behaviour.

For example:

  • No link behaviour modification, no delay.
    If a browser doesn't support beacons, just don't track the outbound click events.
  • No link behaviour modification, with a minimal delay.
    Use the hitCallback method outlined in this support article combined with a timeout of say 500ms (could be a user configurable value) that opens the link after 500ms even if the analytics event hasn't completed transmitting.

While these alternative methods might miss some data capture, I feel they're preferable alternatives to forcing links to open in a new tab.

Compatibility with Turbolinks

Does your script work with Turbolinks ?

I found no mention of this on the readme. I know I had to adapt the original GA script to work with turbolinks 5, otherwise the tracking wouldn't take place during ajax-turbolinks navigation.

Tracking right clicks not working

I tried to track both left and right click events on an A link with

ga-on="mouseup"

using

`ga('require', 'eventTracker', {events: ['click', 'mouseup']});

but only left-click events are visible in the Real Time view. Am I missing something? It looks like it should work, but apparently it doesn't.

Ability to filter URLs

It would be nice to be able to filter URLs, for example to strip out IDs from a URL. Maybe this would be part of the cleanUrlTracker?

For me, I'd be using a filter like this:

function (url) {
  url.replace(/\/\d+/g, '/_id_');
}

Touchstart event logging non-existent clicks

I have reviewed your code because of https://www.drupal.org/node/2671716 and like to ask how you would solve Touchstart event logging non-existent clicks.

I have a document listener bound to "mousedown keyup touchstart" as you can see in http://cgit.drupalcode.org/google_analytics/tree/js/google_analytics.js to overcome the other serious bugs autotrack currently has like:

Monitoring the mouse movement looks also a problem as I found on the net. Any other ideas?

Change the default 'data-event-' to 'data-tracking-event-'

Pls Change the default from...
ga('require', 'autotrack', {'attributePrefix': 'data-tracking-event-'});
ga('require', 'autotrack', {'attributePrefix': 'data-event-'});
https://github.com/googleanalytics/autotrack#passing-configuration-options

User-case: This makes it obvious to developers that this is used for tracking, and reduces the chance of conflicts.

Thanks

Phil

Copied from here:
https://plus.google.com/+JimGianoglio/posts/DKvR95C8MWJ

No counting

Hi,

on one of my websites it´s working perfectly. But on deine-angelwelt.de are some issues.

When I insert this:

ga('create', 'UA-???????-1', 'auto');
ga('require', 'autotrack');
ga('send', 'pageview');

Its counting nothing - also no visitors. When I change this:

ga('create', 'UA-???????-1', 'auto');
ga('send', 'pageview');
ga('require', 'autotrack');

It´s counting only the visitors, but no clicks.

Maybe there are some security plugins, which stop the .js?!

Best,
Paul

Tracking links for event tracker

I am not sure if this is the right place to ask.
Currently I am using eventTracker to track the links on a div container, So I have setup data attributes on the div container and want to track the link clicks.

Can i have the Event Label value as the value of href,

This way, I can track the module category and which link was clicked?

Q: Does autotrack work with an angularjs single page app?

As per the following excerpt from the docs:

Note, this plugin does not support tracking hash changes as most Google Analytics implementations do not capture the hash portion of the URL when tracking pageviews.

Does it mean that it will not track virtual page changes in an angularjs app?

Where to check the "socialTracker" report?

I installed Autotrack, now I can see session duration, outbound links reports clearly.

But where can I check the "socialTracker" report? I read the usage guide time after time, and can't find this report in my GA's profile.

Translations need to be updated

@nebosuker and @stevezhuang, please update your forks at your convenience with the new documentation changes for the 1.0 release.

Also, please update the settings in your forks to allow for issues to be reported, so users can file issues with your forks rather than this repo. These instructions will show you how:
http://programmers.stackexchange.com/questions/179468/forking-a-repo-on-github-but-allowing-new-issues-on-the-fork

Thanks, and let me know if you have any questions.

Minor question regarding window unload event

I found that this event from the session duration tracker fired hundreds of times (with a huge value that I don't understand) and I found it a little bit unnecessary since it only provides me with a number and doesn't give me an event label or any other data that I could use in analyzing my visitor actions.

I don't really understand too much about how the plugin works, but can I comment out this send event code and not effect the rest of the plugin?

Thanks for your help!

Handle scripts that include autotrack prior to the tracking snippet

If a developer loads the autotrack.js script on the page before defining the global ga object in the tracking snippet (or before the analytics.js script defines it), none of the plugins will load. This happens because the providePlugin method first checks to see if the global ga function exists before calling ga('provide', ...) to avoid errors.

One possible solution is to run the command queue initialization code in the providePlugin method. This will solve the problem in the vast majority of cases, with the exception of the case where the developer wants to rename the global ga object to something else.

The other option is to console.error if the developer tries to load an autotrack plugins before defining the global ga object. The only downside to this approach is users who don't have their developer tools open may not realize an error occurred.

Can't star project

Sorry it's so peculiar that can't help to wonder why the heck this is happening, and only with your repo, any other project around is just fine.

Is this just an issue with me because I'm speshul or what?

urlChangeTracker doesn't seem to work

I'm basing this on when I view the real time stats the active page url doesn't change.

I have a Marionette app compiled using browserify so I've tried require('autotrack') and a direct link to the autotrack.js file

Here my tracking code snippet.

<script>
    window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
    ga('create', 'UA-XXXXX-Y', 'auto');
    ga('require', 'autotrack');
    ga('require', 'ec');
    ga('send', 'pageview');
  </script>
  <script async src='https://www.google-analytics.com/analytics.js'></script>

Tracking internal forms

I feel like I'm missing something obvious here, but there's no tracking of internal form submissions, only forms that submit to other websites?

I've used the options to track internal forms by removing the domain check

shouldTrackOutboundForm: function(form) {
var action = form.getAttribute('action');
// Checks that the action is set and starts with "http" to exclude relative
// paths, then checks that it does not contain the string "example.com".
return action &&
    action.indexOf('http') === 0 ;
   // && action.indexOf('example.com') < 0; //we wnat to track internal forma as well
  }

Is this something that should happen by default?

I would have thought that adding events to internal forms would be one of the most important things to track.

When a form doesn't have "action" attribute exception is thrown in FF and IE

https://github.com/googleanalytics/autotrack/blob/master/lib/plugins/outbound-form-tracker.js#L83-L88

In this method when getting the action attribute, for Chrome if it doesn't exist getAttribute("action") returns empty string, so "".indexOf("http") works perfectly, but in IE and FF the same returns null, what happens is something like this null.indexOf("some string") , so the error is "action is null" in FF .... and similar in IE. What I did to fix this in the project that I work on is to add an empty attribute in the form, e.g. action="". The simplest fix that could be done is: when declaring action variable and assigning it the value of the action attribute to put some condition ... if no action then empty string for example:

var action = form.getAttribute('action') || "";

Set enable ga('require','autotrack'); on all NEW GA installations via UI

Set enable ga('require','autotrack'); on all new GA installations in the UI (unless gtm.js found on homepage).

I can see that GA is trying to fix the problem of incorrect AvgSesisonDurations & BounceRates at scale for website that do not use GTM. I have seen both snowplow and YandexMetric introduce simular features (both vendors appears to have this enable by default on "new" implementations in the installation interface).

  1. enableActivityTracking (aka "Page pings")
    http://snowplowanalytics.com/documentation/recipes/catalog-analytics/measuring-and-comparing-content-page-performance.html#page_pings
    https://github.com/snowplow/snowplow/wiki/2-Specific-event-tracking-with-the-Javascript-tracker#enableActivityTracking
  2. accurateTrackBounce
    https://yandex.com/support/metrica/code/counter-initialize.xml

Thanks

Phil.

Copied from here:
https://plus.google.com/+JimGianoglio/posts/DKvR95C8MWJ

Reducing HTTP requests

Hello,

In terms of implementation, assuming you use all the 9 plugins, that'd be 9 additional http requests. Is there a way to reduce this and have 1-2 consolidated JS files (analytics.js + all_plugin.js)

Thanks

Autotrack internal URL's that are redirects to external sites?

Let's say I have the following URL structure:

www.example.com/goto/site1
www.example.com/goto/site2
www.example.com/goto/site3

Is there a way to setup autotrack to track all these links, for example by matching www.example.com/goto/* ?

A workaround would of course be to setup a subdomain so that the links would look like:

ext.example.com/goto/site1
ext.example.com/goto/site2
ext.example.com/goto/site3

This way, if I'm understanding the documentation correctly, the links should be autotracked. But I'd rather not complicate things like this if there's an easier way.

Tag Manager

This may be a silly question, but is there a way to use this in Tag Manager with the Page View tag?

How to notify EventTracker about DOM updates

Hi!

I have such simple case:

  1. I init EventTracker as usual
  2. Later on, I update DOM, ie. I add some new links with data-event-* attributes.

How do I make sure EventTracker binds to click event on these newly inserted links and handle click events properly?

Cross domain or *.domain.com is not an Outbound link

I have reviewed your code because of https://www.drupal.org/node/2671716 and found some issues with the code.

That is not the way how oubound need to work.

OutboundLinkTracker.prototype.shouldTrackOutboundLink = function(link) {
  return link.hostname != location.hostname &&
      link.protocol.indexOf('http') === 0;
};

There is cross domain suppoet in GA and also subdomain support. That means you need to support *,example.com and also a list/array of cross domain hostnames. Outbound is than only if you leave the site and not because you switch from "example.de" to "example.es". In this case you stay on the same site, you only switch the language of the site (cross domain support).

If you switch from www.example.com to shop.example.com you also do not leave the site.

urlChangeTracker changing page to `undefined` in IE11

I've been doing some work on a single-page javascript application that calls history.replaceState with only two arguments - the optional URL is unspecified. I've been integrating GA to track visits and some internal events. Since some of our events update the URL to reflect a change in state, I figured it would be nice not to have to manually handle those occasions, and tried using the urlChangeTracker plugin to capture those events for me. Works great in Chrome. But I hit a snag in IE11.

The problem seems to be thanks to

this.originalReplaceState.call(history, state, title, url);
. In particular, the url variable is undefined. In Chrome, this works as expected as the undefined variable is passed on and ignored. But IE11, for some reason, treats this as an undefined string literal, and my page gets updated from eg /path/index.html to /path/undefined. So this is a difference in behaviour in how IE11 handles the arguments. I can reproduce it independently of the plugin with the following steps:

  1. Visit some website, for example, http://github.com/
  2. In the dev console, run var t;
  3. Now run history.replaceState({}, '', t)
  4. In Chrome, the location doesn't change. In IE11, it changes to http://github.com/undefined

In any case, this is of course throwing off my stats tracking. I'm going to get around this in my project my manually tracking the extra events. I imagine others who want a proper workaround for this could override history.replaceState themselves prior to running the plugin, using a function that explicitly checks if that third variable is undefined, and if it is, directly calls the original history.replaceState with only two arguments instead (which does still work as expected in IE11).

I raise this here to ask if it's worth making such a change in the plugin directly. It might prevent other users having issues like mine in the future.

Outbound Link Tracking breaks ASP.net __doPostBack() javascript links in IE 11

I added autotrack.js to a site that uses ASP.net, which generates links that use "javascript:" in the href attribute:

<a id="foo_bar" href="javascript:__doPostBack('foo$bar','')">Linked Item</a>

When clicked, those links attempt to open "javascript:__doPostBack('foo$bar','')" as a URL (whi, and don't execute the javascript.

This only happened to us in IE 11. It worked fine in the latest Chrome and Firefox.

Sorry if I'm not reporting this correctly or well... I'm new to Github (, and I don't totally understand why this is happening, I can only confirm that it is happening. I'm just reporting this in case the script can be edited in some way to account for this edge problem.

Add optional event-id, event-entity-type and event-action-type

Add optional "event-id, event-entity-type, event-action-type"
data-event-id="12345"
data-event-entity-type="component"
data-event-action-type="click"
https://github.com/googleanalytics/autotrack#using-individual-plugins

User-case: event-id is needed for auto-QA testing, and event-action-type=onclick | onload is needed for determining nonInteractive value.

Thanks

Phil.

Copied from here:
https://plus.google.com/+JimGianoglio/posts/DKvR95C8MWJ

Will autotrack be an official plugin?

In docs there already are some official plugins for GA. Will autotrack be added there? If yes, will it also be available as an option within GTMs GA tag config screen?

GTM

Hello!

Little question regarding autotrack, is it or will it be supporting GTM?

Cannot find fieldObjects

Hello,
I am very excited to use your script. I installed the complete files, although I am currently only using the outboundLinkTacker. Where can I set the fieldsObject to true nonInteraction:true?
I do not want those single page users added to the bounce rate.

Below are GA's code examples:

ga('send','event', [eventCategory],[eventAction],[eventLabel],[eventValue],[fieldsObject]);

ga('send', 'event', 'Videos', 'play', 'Fall Campaign', { nonInteraction: true });

Just for reference here is my outbound link example:
<a href="" target="_blank" data-event-category="Appointment" data-event-action="Schedule" data-event-label="Clicked" data-event-value="500" class="">Schedule Appointment Online</a>

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.