Crawling and Google Analytics integration, done!

It’s been a while since we added features to Gwt-Platform and since Google I/O is finished, we felt that some feature needed to be dealt with. One of these is the ability to easily let any GWTP application be crawlable by a search engine crawler following Google’s guidelines. For a while now we had a basic implementation that was used by many of you to build your own solution. But speed issues and timing constraints made it impossible to use the same approach on AppEngine. Now with features like always on and warmup request we can offer something easy to install and responsive. For more information about how to make the crawler work, take a good look at this piece of documentation.

The second feature we worked on is the seamless integration of your presenter-based application with Google Analytics. This new feature will automatically track any navigation event and presenter change provided you add the following bindings to your gin module:

    bind(GoogleAnalytics.class).to(GoogleAnalyticsImpl.class).in(Singleton.class);
    bindConstant().annotatedWith(GaAccount.class).to("UA-XXXXXXX-X");
    bind(GoogleAnalyticsNavigationTracker.class).asEagerSingleton();

The first line let’s you bind the various google Analytics function to our implementation, this line can be avoided by installing the new default module that we introduce with GWTP 0.6. The second line is where you bind your Google Analytics account to this application and the last line is where the tracker is actually instanciated alongside your application. As you can see, these three little lines will take care of everything and you’ll even be able to go further by injecting the GoogleAnalytics interface wherever you need it, so you can easily track custom events right from your GWT code. For more information about GWTP integration with Google Analytics check out this documentation page.

These features are only available in trunk and 0.6-SNAPSHOT for now. However the official release of GWTP 0.6 is planned for very soon. Stay tuned!

3 comments

  1. bloogt · August 10, 2012

    Hi, have you had any luck using Google’s “In-Page Analytics” (part of their Analytics service) when you’ve loaded ga.js via your GWT object (as opposed to directly in the host html file) ?

    • Christian Goudreau · August 14, 2012

      I didn’t try that yet! Let me know if it works for you 😀

      • bloogt · August 15, 2012

        Turns out that Google Analytic’s “In-Page Analytics” looks for a Google hosted ga.js in the host file for that function to work. That’s a shame! I like having that external resource bundled with the GWT code. I’ll open a bug with Google. Thanks!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s