Thursday, December 1, 2016

Re: Integrating Google Analytics with GWT (SPA) Application to capture the User Flow


our gwt application is single page i have lot of tabs and dashboard ,i want a global event which capture all the event with widget name.
is It possbile in GWT?

You can globally listen for event previews using Event.addNativePreviewEvent() but that probably won't help you a lot as you will only see target elements of the underlying native browser event instead of widgets (browser doesn't know anything about widgets). Figuring out which widget belongs to any given element isn't really doable. What might be possible is to add custom attributes to, e.g. your tab, and once you have received a native preview event visit each parent of the target element until you find one having your custom attribute. Such an attribute could be data-tracking="page:my-page" or similar.

Otherwise you need a general abstraction of pages in your app. For example if you use GWT Places you could treat each PlaceChangeEvent (globally fired on the event bus) as a page view (using the place token as identification). If you only use GWTs History class and somehow generate history tokens on your own you can do the same by listening on the History using History.addValueChangeHandler(). 

If you don't have such a concepts in your app then you are probably out of luck and the only solution is to call the ga() method manually in each event handler (tab selections, anything that changes your "pages").

-- J.

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment