Giter Club home page Giter Club logo

gas's People

Contributors

dbarlett avatar eduardocereto avatar timse avatar tomfuertes 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

gas's Issues

track mailto: links

This is an old idea, and I see less and less people usig mailto: links. Still it could be good to have.

Change plugins API to avoid conflicts with default functions

I feel that I don't get the API right. We have 2 problems with the current API.

  • For functions that are gas specific we don't clearly indicate that GAS is handling that call instead of ga.js. eg: (_trackOutboundLinks can be added in the future by ga.js and then we have a problem.)
  • For functions that are not gas specific we change the behaviour but that is not explicit on the API. eg: (_addDomainName is both a GAS and gaq function. We alter it behaviour and GAS may or may not push that into gaq).

So I'd like to prupose a different API, to make it clear what GAS is doing and what is it most likely not touching while sending to ga.js

I first started thinking about it while planning to implement social trackings. Following the consistency with current API _trackOutboundLinks, _trackDownloads the most logic choice would be _trackSocial, but that already exists on ga.js.

So instead of using track Social I have a couple of choices:

  • _gasSocial. It's nice because it's namespaced, so we'll never have a clash with g.js functions again. The bad aspect of it is that _gas becomes redundant when you look at the whole call. _gas.push(['_gasSocial']);
  • _setAutoTrackSocial, This is more consistent with ga api but we might have problems in the future as well. There an undocumented function incide ga/js called _setAutoTrackOutbound, I expect that in the future it might replace our _trackOutbound , and that in the future ga.js might have more functions like that.

So my opinion is that we should rename all our plugins for v1.6 keeping backward compatibility. Possibly removing the deprecated names on v2.0.

  • _trackOutboundLinks -> _gasOutboundLinks
  • _trackDownloads -> _gasDownloads
  • _trackForms -> _gasForms
  • _trackVimeo -> _gasVimeo
  • ...

Still no luck with in-page analytics

This is a follow up to #52 and #53.

After making the changes suggested in #53, the errors disappeared from the console, but we still get the error screen in Analytics (see screenshot in #52).

At this point it appears we will have to consider dropping GAS, but before doing so I wanted to check if we will lose any of our Analytics history if we switch from GAS to regular GA. Can you comment on this? Thanks for your help on this issue.

track Social

Try to find out what kind of social tracking we can do by default

Errormessages in Chrome Developer tools console

Hi,

Data in analytics seems fine, but receiving various errormessages in chrome developers tools console for the trackforms, maxscroll and outbound links on site www.uretek.nl

Example:


Called method "_gasTrackForms" threw exception.TypeError: Cannot call method 'apply' of undefined
log
N
G.S
G.push
a.(anonymous function)
v
p._execute
(anonymous function)
G.S
G.push
a.(anonymous function)
(anonymous function)
$e
a
(anonymous function)
(anonymous function)


Any suggestions on these errors?

Detect double tracking

Right now if you call most of the filters multiple times they may issue multiple event bindings resulting on multiple hits been sent to GA.

We better flag if a tracking already happened and drop that instead.

In addition to that it would be nice to be able to call _trackYotutube or _trackVimeo multiple times to find videos added by ajax. There's a common use case of people using videos inside lightbox.

Tracking Qualaroo survey

Here a code to track Qualaroo survey into GA. For the moment, this code required jQuery. I may need some time to make this code work without jQuery.

/**
 * GAS - Google Analytics on Steroids
 *
 * Track Qualaroo surveys
 *
 * Copyright 2011, Cardinal Path and Direct Performance
 * Licensed under the GPLv3 license.
 *
 * @author Sébastien Brodeur <[email protected]>
 */

/**
 * get the form name for a specific elemet
 *
 * @param {DOMElemet} el Dom Element.
 * @return {String} Form Name or Id.
 */
function getFormName(el) {
    while (el && el.nodeName !== 'HTML') {
        if (el.nodeName === 'FORM') {break; }
        el = el.parentNode;
    }
    if (el.nodeName === 'FORM') {
        return el.name || el.id || 'none';
    }
    return 'none';
}

var _gasTrackQualaroo = function (opts) {
    if (!this._qualarooTracked) {
        this._qualarooTracked = true;
    } else {
        //Oops double tracking detected.
        return;
    }

    // Make sure required attrs are defined or fallback to default
    opts['category'] = opts['category'] || 'Qualaroo-';

    // Fire when the user submit the survey.    
    _kiq.push(['eventHandler', 'submit', function () {
        // Retrieve Qualaroo survey ID.    
        surveyId = $("[src*='s3.amazonaws.com/ki.js']").attr("src").match(new RegExp("(id=)([0-9]*)&"))[2];

        // For each survey questions...   
        for (i = 0; i < $("[class*='ki_question']").length; i++) {
            // ... get the question text...   
            question = $("[class*='ki_h1']:eq(" + i + ")").text();

            // ... and the selected anwser text    
            // Check first for radio button answer.   
            anwser = $("[class*='ki_question']:eq(" + i + ") input:checked[type='radio']").closest("label").text();

            // Then for checkbox answer   
            if (anwser == "" || anwser == null || anwser == undefined) {
                anwser = $("[class*='ki_question']:eq(" + i + ") input:checked[type='checkbox']").closest("label").text();
            }

            // Then for textbox answer(s)   
            if (anwser == "" || anwser == null || anwser == undefined) {
                anwser = $("[class*='ki_question']:eq(" + i + ") textarea").val();
            }

            // And finaly, score   
            if (anwser == "" || anwser == null || anwser == undefined) {
                anwser = $("[class*='ki_question']:eq(" + i + ") [class*='active'] a").text();
            }

            // If both data are available, queue a Google Analytics _trackEvent tag.    
            if (question && anwser) _gas.push(['_trackEvent', opts['category'] + surveyId, question, anwser]);
        }
    }
};

_gas.push(['_addHook', '_gasTrackQualaroo', _gasTrackQualaroo]);

document print event

Firefox and MSIE support printing events beforeprint and afterprint. Webkit browsers don't support that.

We could also rewrite the window.print() function to track an Event. It will only work when the printing event comes from the page and won't work when it comes from the browser.

So I don't see a perfect solution but we should be able to get some nice data out of it. I wonder if it is important or not.

I'd like to hear some opinions on this idea.

Improve Outbound link

Many pages dynamically load some of content using Java Script (AJAX). If in dynamically loading content is some outbound links, GAS won't track them. In jQuery is something like .live() to solve this problem. It is possible to improve Outbound link tracker this way?

Thanks.

Option to track with virtual pageviews

Say, file downloads, we often track with virtual pageviews:
/virtual/download/readme.pdf

This is because we see these type of files, semantically, as page views, they often open in the browser or some kind of viewer. We apply this to outbound links as well. This comes with the benefit of setting upp great goal funnels, which still is pretty limited with events.

Would be great to be able to alter something along the lines:
_gas.push(['_trackOutboundLinks', {method: 'pageview', path: '/virtual/external-link/'}]);
_gas.push(['_trackOutboundLinks', {method: 'event', category: 'External Link'}]);

extract script parts

can any describe in short how to only use the vimeo tracking part of the code for example? (extract it so to say)
and with universal analytics is preferrable.

I tried several vimeo tracking suggestions but GAS works best out of the box and I did not get others working yet.

we do not need pageview, downloads and etc. since we already have tracking on this.

It can maybe be a good idea to have a general guide for how to 'extract' code parts

The customer in mind already has universal analytics tracking which is why we would like the vimeo tracking to be as well.

reimplement live tracking

Reimplement live tracking. Bublling up this time to find the event.

We also should use live tracking by default on some plugins

  • trackOutbound
  • trackDownload
  • trackForms

Mailto Link Problem

Bug / The following mailto Link does not fire an event:

<a href="mailto:?subject=Lesetipp 'UDG-United Digital Group ist die neue Agenturgruppe für digitales Marktmanagement und Kommunikation.'&body=Hallo,%0d%0a%0d%0aich habe auf http://www.udg.de/ einen interessanten Artikel gefunden:%0d%0a">

I suppose this is because there is no "@" in it.

Surpress pushes to _gasTrack* from hitting _gaq

Feels so dirty getting these error messages all over my console :(

_gaq.push processing "_gasMultiDomain" for args: "[mousedown]":  ga_debug.js:18
> Called method "_gasMultiDomain" threw exception.TypeError: Cannot call method 'apply' of undefined ga_debug.js:18
_gaq.push processing "_gasTrackOutboundLinks" for args: "[]":  ga_debug.js:18
> Called method "_gasTrackOutboundLinks" threw exception.TypeError: Cannot call method 'apply' of undefined 

Thoughts?

Negative event values do not work

There is a line that says if the fourth argument of the event is negative, set it to 0. This is bad in this use case: Cart value tracking. People add and remove from the cart. Removing is an event with a negative value. Using the total and average value columns of the events reports you can see the aggregate cart values.

With GAS setting negative values to zero, this tracking is impossible. Should be corrected to allow for negative event values.

Improve testing framework

I'd like to put up some better unit tests. We have some tests on QUnit and some manual test pages as well under test now.

The ideal scenario would be to have phantom and casper.js.
Casper.js itself has some very good tests setup that we could use as a base:
https://github.com/n1k0/casperjs

Problem loading in-page analytics (follow up)

This is in reference to a closed issue: #52

It was closed prematurely, IMO, since the issue was not resolved. Forgive me for being persistent, but I figured that closed issues are not monitored, so it would make sense to post a new issue.

I added the in page analytics plugin, but to no avail. The error continues. I added the Google Analytics debugging extension for Chrome and discovered a few JS errors, which you can see in the attached screenshot.

error-js

Any ideas?

Outbound Link tracking between Subdomains

Feature / I've seen that an event is fired, when you switch between subdomains. Some clients use internal links with and without www., so every time you switch between "subdomains", an events gets fired. i know this is maybe a rare ocassion but i think it might help if you could control outbound tracking between subdomains, especially on large accounts where you are about to reach hit limits.

Maybe you could do something like this:
_gas.push(['_trackOutboundLinks',{subdomains: '.*']); //fires event for all subdomains
_gas.push(['_trackOutboundLinks',{subdomains: 'www,root,']); //fires event for root and www.

Or like this:
_gas.push(['_trackOutboundLinks',true]); //fires event for all subdomains

_gas.push(['_trackOutboundLinks',false]); //does not fire events between subdomains

Cross domain - visits but 0 pageviews, 0 pages/visit, 0% bounce rate

Hi -

Using the following GAS script:

var _gas = _gas || [];
_gas.push(['original._setAccount', 'UA-######-#']); //keeping tracking for historical account
_gas.push(['original._setDomainName', '.domain1.org']);
_gas.push(['original._trackPageview']);
_gas.push(['_setAccount', 'UA-######-#']); 
_gas.push(['_setAllowLinker', true]);
_gas.push(['_setAllowAnchor', true]);
_gas.push(['_setDomainName', '.domain1.org']);
_gas.push(['_setDomainName', '.domain2.com']);
_gas.push(['_setDomainName', '.domain3.com']);
_gas.push(['_setDomainName', '.domain4.com']);
_gas.push(['_gasMultiDomain', 'click']);
_gas.push(['_trackPageview']);
_gas.push(['_gasTrackForms']);
_gas.push(['_gasTrackOutboundLinks']);
_gas.push(['_gasTrackMaxScroll']);
_gas.push(['_gasTrackDownloads']);
_gas.push(['_gasTrackYoutube', {force: true}]);
_gas.push(['_gasTrackVimeo', {force: true}]);

(function() {
var ga = document.createElement('script');
ga.type = 'text/javascript';
ga.async = true;
ga.src = '//cdnjs.cloudflare.com/ajax/libs/gas/1.10.1/gas.min.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();

On all the cross-tracked domains we're showing visitors but 0 page views and 0% bounces everywhere. Screenshot:

screen shot 2013-06-05 at 4 38 05 pm

Clicking link: el is undefined

I receive the following error when I add on any link when I track _trackOutboundLinks, _trackDownloads, or _trackMailto

_trackPageview, _trackForms, and _trackMaxScroll seem to work fine.

Error

for (var el = me.srcElement; el.nodeName !== 'HTML';

I am loading jQuery and some other scripts as well, could it be a load timing issue?

Full script I am including:

   var _gas = _gas || [];
   _gas.push(['_setAccount', 'UA-23636765-1']);
   _gas.push(['_setDomainName', '.seedleaf.com']);

  _gas.push(['_trackPageview']);
  _gas.push(['_trackForms']);
  _gas.push(['_trackOutboundLinks']);
  _gas.push(['_trackMaxScroll']);
  _gas.push(['_trackDownloads']);
  _gas.push(['_trackMailto']);
  (function() {
    var ga = document.createElement('script');
    ga.type = 'text/javascript';
    ga.async = true;
    ga.src = 'javascripts/shared/gas.js';
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(ga, s);
   })();

Trying to track same page anchor links

Can I use _gas.push(['_trackPageview', location.pathname + location.search + location.hash]);
like
_gaq.push(['_trackPageview', location.pathname + location.search + location.hash]);

or is there a better way to track anchor links with GAS?

GAS outbound tracking and timeout

The official Google documentation suggests a small timeout before tracking outbounds. How does the GAS implementation tackles this workaround navigation?

I want to implement an onclick custom variable set for a few links and was wondering if I can leverage GAS without throwing my own timeout implementation

Switch compiler to uglifyjs

I'm thinking about switching compilers to uglifyjs.

I'm having problems with closurecompiler mangling too many variables.

I already implemented it in develop. But I wanted to open this issue to get feedback.

It also feels better to me to have a minifier that is open source and based on javascript instead of closure compiler.

Event bubbling for internet Explorer 8-

The change/submit events don't bubble on ie 6, 7 and 8. So the form Tracking is not working for these browsers on develop.

We have a couple of options here:

  1. Ignore ie 8- for FormTracking
  2. Go back to non-live bindings for Form Tracking
  3. Implement a LOT of code to make it work on ie8-
  4. Use jQuery if available to overcome this problem

While I think 4 is a good idea we don't want to depend on jQuery, so it would fix the problem just for a subset of the users that happen to have jQuery.

I think that for now I'll remove the live Bindings from the Form Tracking. But I'll leave this bug open.

Doc questions

Hey Eduardo -

Wondering how I would "translate" this GATC into GAS (with cross domain tracking for domain1, domain2 on the UA-yyyyyyyy-y account) :

_gaq.push(['o._setAccount', 'UA-xxxxxxxx-x']); // old legacy id retained for data reasons
_gaq.push(['o._trackPageview']);
_gaq.push(['xd._setAccount', 'UA-yyyyyyyy-y']); // id for cross domain tracking
_gaq.push(['xd._setDomainName', 'domain1.com']);
_gaq.push(['xd._addIgnoredRef', 'domain1.com']);
_gaq.push(['xd._setAllowAnchor', true]); // needed on the cross domain tracking only
_gaq.push(['xd._setAllowLinker', true]);
_gaq.push(['xd._trackPageview']);

Would it look like:

_gas.push(['o._setAccount', 'UA-xxxxxxxx-x']);
_gas.push(['o._trackPageview']);
_gas.push(['xd._setAccount', 'UA-yyyyyyyy-y']);
_gas.push(['xd._setAllowAnchor', true]);
_gas.push(['xd._setAllowLinker', true]);
_gas.push(['xd._setDomainName', 'domain1.com']);
_gas.push(['xd._setDomainName', 'domain2.com']);
_gas.push(['xd._setMultiDomain', 'click']);
_gas.push(['xd._trackPageview']);

How to handle addIgnoredRef, since setDomainName is being used to add domains into the cross-domain tracking? Maybe not that important. Is claimed to reduce self-referrals, but may not be needed.

Password protected pdf file tracks

Hello,

Excuse me if this is not the right place for this.

I want to implement this on password protected pdf files. Would that work?

Thanks

Help with MailTo Tracking Error using Icon Rather than Text as Link

Seems like any of the mailto links I have that are using an envelop icon rather than an actual text link aren't firing the tracking event for mailto. Here is the structure of the link:

<a href="mailto:[email protected]"><em class="icon-envelope-alt">&nbsp;</em></a>

Any reason why this shouldn't work with GAS? Any tips on getting it working?

Mailto links where the address is the link rather than an icon seem to work.

YouTube percentages not used

I followed the example in the readme to add percentages: [25, 50, 75, 90] to the _gasTrackYoutube call, but did not see any percentage events in GA. Stepping thru in Firebug showed that lines 209-215 of youtube.js result in opts = {} and thus opts['percentages'] = [].

gas _setDomainName questions

Question / When using the gas MultiTrack feature, does _gas.push(['_setDomainName', 'myothersite.com']); also catch any linked subdomains? Eg, a link to blog.myothersite.com?

Does the first _setDomainName showup as the domain label in GA reports?

Feature Request: Tag everything you like!

Hi Eduardo,

What if we could specify Events/Pageviews for every element on a page we like to track. Say we want to track interactions with jquery accordeon

. It would be great to specify this, maybe directly in the JS code, similar to the OpenTag tag management js (https://github.com/QubitProducts/OpenTag/wiki/How-it-works).

I am not sure if it makes sense to specify rules within the tracking Code calls (e.g. _gasTrackEverything), as there can be lots of information to it, but I'll leave that up to you, as you are the master ;-). Maybe it could look similar to the _addHook function, but I wonder how more than one rule could be specified then...:

_gas.push(['_gasTrackEverything', '_trackEvent', {
object: 'div',
id: 'track',
page: 'website.com/test.html'
},click]);
_gas.push(['_trackEvent', 'jQuery',id,object]);

Regards,

Sebastian

Using a different label for youtube video tracking

Hi all,

Is there a way for me to provide a label other than the youtube url? Ideally I'd like to get the label from a data attribute if possible.

I initially tried adding a hook for you tube events as follows but to no avail:

    _gas.push(['_addHook', '_gasTrackYoutube', function(options){
        // do stuff...
        return options_with_different_label;
    }]);

I though of using the _trackEvent hook but that'd get a bit ugly with switches on the category and I'm not sure how I could get to the iframe data attributes.

Other than that it looks like the only option would be to add a some kind of hook to the _ytStateChange function that can use the event['target'] to return a different label.

Any help greatly appreciated.
Cheers

HTML5 Video tracking

Hi, I'd added this code to gas..
_gas.push(['_gasTrackVideo'])
Now, I want that event label in google analytics would be the id of the Video
<video id="foo".....

Is it possible?

Thanks.

MultiDomain doesn't handle form

We should be able to handle forms for multidomain.

I know that for POST forms we can use _linkByPost.

I need to refresh my memory on what is the best way to track GET forms to setup cross domain. Anyone able to help me here?

Dynamically Added Youtube

If you dynamically add youtube iframes with JS, you cannot add re-add the tracker. This fix makes it work:

if (window['onYouTubePlayerAPIReady']) {
  var p;
  for (var i = 0; i < youtube_videos.length; i++) {
    p = new window['YT']['Player'](youtube_videos[i]);
    p.addEventListener('onStateChange', _ytStateChange);
    p.addEventListener('onError', _ytError);
  }
} else {
  window['onYouTubePlayerAPIReady'] = function () {
    var p;
    for (var i = 0; i < youtube_videos.length; i++) {
      p = new window['YT']['Player'](youtube_videos[i]);
      p.addEventListener('onStateChange', _ytStateChange);
      p.addEventListener('onError', _ytError);
    }
  };
}

Problem loading in-page analytics

We've been using your script without issue for some weeks now, but just last week, when signing into Analytics, we receive an error message:

error

There doesn't appear to have been any updates from your end lately, and to my knowledge no one has changed the code on the live site. I verified that the tracking number and domain in your snippet are correct.

The domain in question is www.trustamerica.com.

Do you know what the problem is?

Plugin system rewrite

Problems with the current Plugin System:

  • Dependent on GAS, hard to port out of GAS.
  • All plugins use the same namespace.
  • All plugins in the end go to gas.js, so as we add more plugins GAS gets bigger, even if you don't want to use these plugins.
  • We should be able to select only the plugins we want
  • Possibly load plugins on demand. May be overkill since current plugins are not that large.

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.