3

I'd like to add google analytics on my GWT app (full UiBinding). I read Integrating Google Analytics into GWT application and How to integrate Google Analytics into GWT using the asynchronous script so i know how to call trackviews and stuff, but what i don't understand is: when and where do i call these method ?

I have one entrypoint (.html and .java) and the rest are ui.xml pages.

Should i put some of the GA code in my entrypoint.html and then call the native methods by hand ? Isn't there something more generic/automatic ?

Thanks

Community
  • 1
  • 1
Maxime ARNSTAMM
  • 4,886
  • 8
  • 49
  • 76

1 Answers1

2

Have you checked out the UrchinTracker example on gwt-examples? It's pretty well documented and easy enough to use. If you're using History Tokens, you can use the implementation shown here. That would be the most automatic/generic way I can think of. You can certainly call the native methods from anywhere, but that's not very efficient. Another option is to make an abstract class that you implement for your UI files that takes care of firing off the appropriate native calls.

Chris Cashwell
  • 20,898
  • 13
  • 60
  • 91