isomorphic500 icon indicating copy to clipboard operation
isomorphic500 copied to clipboard

Move google analytics code to RouteActions

Open gpbl opened this issue 10 years ago • 3 comments

It doesn't fit well in the Application.js, also the title would not match since the page it's updated using an action which is async.

gpbl avatar May 01 '15 09:05 gpbl

@gpbl Where would you put them? I wanted to avoid putting them into each and every action, but I do have each of my actions setting a title property on the route. The NAVIGATE_SUCCESS action is then handled in a custom store that now has the correct title and urls, from which I trigger analytics. Did you come up with another solution?

samkelleher avatar Jan 12 '16 22:01 samkelleher

@samkelleher what about using the custom store handling NAVIGATE_SUCCESS?

gpbl avatar Jan 12 '16 22:01 gpbl

@gpbl This is what I have ended up doing, I have a TitleStore which manages the document.title and now calling Google Analytics. It works. However it doesn't record the initial page load, since there is no in-page page navigation. I'm working on this now to find an elegant solution. I can feed back what I end up doing. I've been using your amazing starter project as a guide. 😍

samkelleher avatar Jan 12 '16 22:01 samkelleher