Skip to content
Richard Wallis edited this page Aug 27, 2014 · 3 revisions

Add the following to your pom

	  <dependency>
			<groupId>com.arcbees</groupId>
			<artifactId>universal-analytics</artifactId>
			<version>2.0</version>
		</dependency>

Add the following to your gwt.xml

	<inherits name="com.arcbees.analytics.Analytics"/>

Then in your gin module:

install(new AnalyticsModule.Builder("UA-XXXXXXXX-X").build());

##Advanced Install

By default AnalyticsModule.Builder will automatically create a tracker for you.

If you want to set up your tracker manually (eg because you want to use plugins) call:

install(new AnalyticsModule.Builder("UA-XXXXXXXX-X").autoCreate(false).build());

Then in your GWT entry point or bootstrapper if you're using GWTP call the following:

analytics.create().go();
analytics.enablePlugin(AnalyticsPlugin.DISPLAY); //Provides demographics information.

##Server Side

install(new ServerAnalyticsModule("UA-XXXXXX-X"));

You can use analytics on the server exactly the same as you do on the client.

Server side calls work via the Measurement Protocol

A filter will automatically fill out the Measurement Protocol required fields for you from the _ga cookie or create the cookie if it doesn't exist.

setGlobalOptions() and enablePlugin() have no effect on server calls.

If you're using multiple trackers then you should call create().trackerName("My Tracker").go() to create your tracker before making the tracker call. All other options sent to create() on the server will be ignored.

If you're using SetCookieName() on the client then the automatic filter will not be able to keep the server and client in sync since it assumes that the cookie name is : _ga. Raise an issue on this project if you need to set the cookie name for some reason.

Clone this wiki locally