revolunet / angular-google-analytics

Google Analytics tracking for your AngularJS apps
MIT License
652 stars 172 forks source link

Exclude url from tracking with ui-router #178

Closed lyvyu closed 7 years ago

lyvyu commented 7 years ago

Hello, i have a problem here, i am using this module with ui-router but i have one url not to be tracked because i send this manually with Analytics.trackPage('...').

The question is how can i get this done ?

Thanks in advance.

lyvyu commented 7 years ago

So guys ? anyone could help ?

martyzz1 commented 7 years ago

I think you will have to use Analytics.trackPAge() on all pages... and wrap this call in an if not page_url = dont_track_url)

You could do this using a rootScope stateChangesuccess handler...

lyvyu commented 7 years ago

@martyzz1 Yeah, thanks man, i've already did this: `

  $rootScope.analyticsExceptionRoutes = [...];

  ...

  // check if need to track page
  if ($rootScope.analyticsExceptionRoutes.indexOf($location.path()) === -1)  {

    Analytics.trackPage($location.path());

  }

` but it thought that it might be another way to do this without writing any code of mine. Any way, thaks dude for the answer!

Toxantron commented 7 years ago

For ngRoute I added support a while back to include such configurations into the route definition as you can see here. There was also the attempt to customize the behavior of route tracking with a new API in the future in #149.

However due to a shift in personal priorities my time for this project is down to almost zero. Maybe it is a starting point for you though.

lyvyu commented 7 years ago

@Toxantron well thanks, ok...i think i'll give a try for this.