Git Product home page Git Product logo

analytics.js-integration-amplitude's People

Contributors

ccnixon avatar curtisliu avatar djih avatar f2prateek avatar hankim813 avatar ndhoule avatar paladin8 avatar peripheral1994 avatar ucarion avatar wcjohnson11 avatar

Stargazers

 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

analytics.js-integration-amplitude's Issues

Multiple page events fired if using trackAllPages

If I enable trackAllPages and then fire .page with a named page it ends up sending two events to amplitude. This is because the page event does not return after firing the first. Is this behavior expected?

For example:

If my configuration has:

        "Amplitude": {
          apiKey: "[blah]",
          trackAllPages: true,
          saveEvents: true,
          includeUtm: true,
          includeReferrer: true,
          includeGclid: true,
          saveParamsReferrerOncePerSession: false,
          domain: "." + document.location.host
        },

And I call analytics.page('test')

The code first hits https://github.com/segment-integrations/analytics.js-integration-amplitude/blame/master/lib/index.js#L125

  // all pages
  if (opts.trackAllPages) {
    this.track(page.track());
  }

This sends an event to amplitude with event_type: "Loaded a Page" (per what's in analytics.js)

and then gets to https://github.com/segment-integrations/analytics.js-integration-amplitude/blob/master/lib/index.js#L134

  // named pages
  if (name && opts.trackNamedPages) {
    this.track(page.track(name));
  }

Which then sends another event to amplitude with the event_type: "Viewed test Page"

Would it make more sense to have the trackAllPages add the name or category if present and return? e.g.

  // all pages
  if (opts.trackAllPages) {
    if(category){
      return this.track(page.track(category));
    }
    if(name){
      return this.track(page.track(name));
    }
    return this.track(page.track());
  }

Kind of gross, I know.

Update Amplitude library

Currently at 2.1.0, a PR came in to bump it to 2.2.0, but needs to not pull in a gzipped version and testing needs to be done to ensure it'll work.

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.