Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_gasTrackDownloads fails when opts.category only is present #67

Open
googleanalyticsresoneo opened this issue Mar 10, 2014 · 6 comments

Comments

@googleanalyticsresoneo
Copy link

_gas.push(['_gasTrackDownloads', {category: 'Téléchargements'}]);
will fail because opts['extensions'] is never created when only a category option is present

var _trackDownloads = function (opts) {
    var gh = this;
    if (!gh._downloadTracked) {
        gh._downloadTracked = true;
    } else {
        //Oops double tracking detected.
        return false;
    }
    if (!opts) {
        opts = {'extensions': []};
    } else if (typeof opts === 'string') {
        // support legacy opts as String of extensions
        opts = {'extensions': opts.split(',')};
    } else if (opts.length >= 1) {
        // support legacy opts Array of extensions
        opts = {'extensions': opts};
    }
    opts['category'] = opts['category'] || 'Download';

    var ext = 'xls,xlsx,doc,docx,ppt,pptx,pdf,txt,zip';
    ext += ',rar,7z,exe,wma,mov,avi,wmv,mp3,csv,tsv';
    ext = ext.split(',');
    opts['extensions'] = opts['extensions'].concat(ext);

Exception TypeError
: Cannot call method 'concat'0 of undefined

@tomfuertes
Copy link
Contributor

Good find! Would you like to take at the PR on this one?

@googleanalyticsresoneo
Copy link
Author

Sorry Tom but what does PR mean ? (I'm not so used to github processes)

@googleanalyticsresoneo
Copy link
Author

A Pull Request ?!
https://help.github.com/articles/using-pull-requests
I can give it a try, but feel free to revise it completely :-)

@tomfuertes
Copy link
Contributor

Yep a Pull Request! :) Happy to revise.

@googleanalyticsresoneo
Copy link
Author

From which branch should I perform the edit ?

@tomfuertes
Copy link
Contributor

Develop

-Tom (via phone)

On Mar 11, 2014, at 12:36 PM, RESONEO Google Analytics [email protected] wrote:

From which branch should I perform the edit ?


Reply to this email directly or view it on GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants