aterris / backbone.analytics

Simple Backbone and Google Analytics Integration
http://andrewterris.com/backbone.analytics/
MIT License
21 stars 8 forks source link

Move trackPageview() from navigate() to loadUrl() #7

Open mitio opened 12 years ago

mitio commented 12 years ago

In one project of mine I needed to move the trackPageiew() call from the overridden version of Backbone.History#navigate() to Backbone.History#loadUrl(). That was needed because in this project I don't call navigate() manually. I just let the location hash change drive the navigation.

If only the hash changes, navigate() is not called and thus nothing is tracked. On the other hand, loadUrl() is called always, because navigate() calls it internally and I think that it might be a good idea to move the page tracking call there.

What do you think about this?

I can send you a PR with the changes if you think it's a good idea.

aterris commented 11 years ago

I don't know how I let this slip and I sincerely apologize. I will take a look at your suggestion as soon as possible (hopefully sometime this week) and let you know what my thoughts are.

I just need to regain context, since I feel like what you bring up has come up previously, but I cannot remember off the top of my head and I can't investigate further at this moment.

So sorry about the 6 months delay and thanks for the input :bomb: