GWT / Google Analytics Integration

500 views
Skip to first unread message

Christoph

unread,
Feb 9, 2007, 12:47:15 PM2/9/07
to Google Web Toolkit
Hi GWTers,

Any ideas or recommendations on how to integrate a GWT app with Google
Analytics?

Thanks,
C

Robert Hanson

unread,
Feb 10, 2007, 11:44:06 AM2/10/07
to Google-We...@googlegroups.com
Sure, it is just a simple JSNI call.

// untested
public native void trackUrchinHit (String pageName) /*-{
$wnd.urchinTracker(pageName);
}-*/

Just call that method whenever you want to track an event in the
interface. You also need to include the Urchin JS code in the HTML
page (obviously).

Rob

JonathanIsTh...@gmail.com

unread,
Mar 19, 2007, 2:36:07 AM3/19/07
to Google Web Toolkit
Hmm, that's exactly what I tried earlier today, but it didn't work
because it would strip off the whole history token. I haven't looked
at the urchin JavaScript, but unless it's obfuscated, it's probably
not too difficult to hack it into allowing you to simply tell it the
"current URL" rather than having it get the current URL from
location.href. Anybody else have any ideas? I really need to get
this working very soon on my site as well.

~ Jonathan

JonathanIsTh...@gmail.com

unread,
Mar 19, 2007, 11:25:33 PM3/19/07
to Google Web Toolkit
Oops, duh, I didn't even finish reading what you wrote, Robert. Once
I looked at the urchin.js file I noticed that you could just pass in
the URL you want to log. Then I looked back at your post and said
that you said exactly that. =P Thanks very much!

~ Jonathan

On Mar 18, 11:36 pm, "JonathanIsTheBestNameE...@gmail.com"

Reply all
Reply to author
Forward
0 new messages