Giter Club home page Giter Club logo

Comments (5)

LRitesh avatar LRitesh commented on September 16, 2024 2

It seems to be working (I'm seeing more than 1 session over time)! I also updated universal-analytics version. Going to test it out a couple of days, then will submit a PR if all looks good.

from ampm.

endquote avatar endquote commented on September 16, 2024

Interesting. Something like this in logging.js seems like it might work.

// Log to Google Analytics.

// Restart a session every 500 events, see issue #40
this._google.eventCount = this._google.eventCount || 0;
var params = {};
if(this._google.eventCount >= 500) {
    params.sessionControl = 'start';
}

this._google.event(data.Category, data.Action, data.Label, data.Value, params);
var queue = _.clone(this._google._queue);
this._google.send(_.bind(function(error) {
    if (!error) {
        this._google.eventCount++;
        return;
    }

    if (error.code === 'ENOTFOUND') {
        // Couldn't connect -- replace the queue and try next time.
        // https://github.com/peaksandpies/universal-analytics/issues/12
        this._google._queue = queue;
    } else {
        // Something else bad happened.
        logger.warn('Error with Google Analytics', error);
    }
}, this));

The version of universal-analytics might need to be updated too... it's pretty old now.

Wanna try it out?

from ampm.

endquote avatar endquote commented on September 16, 2024

Heh, looks like I complained about this at some point myself.
peaksandpies/universal-analytics#12 (comment)

from ampm.

LRitesh avatar LRitesh commented on September 16, 2024

Haha... I was wondering why we didn't notice it before. Okay I'll try out sessionControl and update if that works. Thanks!

from ampm.

endquote avatar endquote commented on September 16, 2024

Fixed in 1.7.8.

from ampm.

Related Issues (20)

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.