Skip to content

Make initial trackPageView optional #23

Description

@danmichaelo

What do you think about providing some option to not add the initial trackPageView on https://github.com/mike-spainhower/angular-piwik/blob/master/lib/angular-piwik.coffee#L176 ?

I've setup my app to call trackPageView whenever UI router notifies me about a state/url change, but this gives double counting from the initial page load, and I'd prefer not having to keep track of whether the state change is the first or not, it just seems messy.

Also, when setting the page title dynamically, the trackPageView from angular-piwik is sometimes called before I've had time to update the title. It would be better to have full control of when to call trackPageView.

I don't write coffee, but in plain js I'm thinking of something like this:

              if (tAttrs.ngpTrackInitial !== false) {
                return $window['_paq'].push(['trackPageView']);
              }
              return $window['_paq'];

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions