Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GWT and Analytics : missing the link

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

like image 394
Maxime ARNSTAMM Avatar asked Jul 14 '26 09:07

Maxime ARNSTAMM


1 Answers

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.

like image 116
Chris Cashwell Avatar answered Jul 19 '26 14:07

Chris Cashwell



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!