angular-piwik icon indicating copy to clipboard operation
angular-piwik copied to clipboard

Make initial trackPageView optional

Open danmichaelo opened this issue 8 years ago • 0 comments

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'];

danmichaelo avatar Dec 30 '15 11:12 danmichaelo