java.lang.Object | |
↳ | com.google.android.gms.analytics.HitBuilders |
Helper class to build a map of hit parameters and values.
Examples:
This will send a event hit type with the specified parameters
and a custom dimension parameter.
Tracker t = // get a tracker. t.send( new HitBuilders.EventBuilder().setCategory("EventCategory").setAction("EventAction") .set(Fields.CustomDimension(1), "dimension1") .build());
If you want to send a parameter with all hits, set it on Tracker directly.
t.set(Fields.SCREEN_NAME, "Home"); t.send( new HitBuilders.SocialBuilder().setNetwork("Google+").setAction("PlusOne") .setTarget("SOME_URL").build()); t.send( new HitBuilders.SocialBuilder().setNetwork("Google+").setAction("Share") .setTarget("SOME_POST").build()); t.send( new HitBuilders.SocialBuilder().setNetwork("Google+").setAction("HangOut") .setTarget("SOME_CIRCLE").build());
You can override a value set on the tracker by adding it to the map.
t.set(Fields.SCREEN_NAME, "Home"); t.send(...); t.send( new HitBuilders.EventBuilder().setCategory("click").setLabel("popup") .set(Fields.SCREEN_NAME, "popup title") .build());Additionally, The builder objects can be re-used to build values to be sent with multiple hits.
TimingBuilder tb = new HitBuilders.TimingBuilder().setCategory("category").setValue(0L) .setVariable("name"); t.send(tb.set(Fields.EVENT_VALUE, "10").build()); t.send(tb.set(Fields.EVENT_VALUE, "20").build());
Nested Classes | |||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
HitBuilders.AppViewBuilder | Class to build a basic app view hit. | ||||||||||||||||||||||||||||||||
HitBuilders.EventBuilder | A Builder object to build event hits. | ||||||||||||||||||||||||||||||||
HitBuilders.ExceptionBuilder | Exception builder allows you to measure the number and type of caught and uncaught crashes and exceptions that occur in your app. | ||||||||||||||||||||||||||||||||
HitBuilders.HitBuilder<T extends HitBuilder> | Internal class to provide common builder class methods. | ||||||||||||||||||||||||||||||||
HitBuilders.ItemBuilder | Item hit builder allows you to send item level sales data to Google Analytics. | ||||||||||||||||||||||||||||||||
HitBuilders.ScreenViewBuilder | Class to build a screen view hit. | ||||||||||||||||||||||||||||||||
HitBuilders.SocialBuilder | A Builder object to build social event hits. | ||||||||||||||||||||||||||||||||
HitBuilders.TimingBuilder | Hit builder used to collect timing related data. | ||||||||||||||||||||||||||||||||
HitBuilders.TransactionBuilder | Transaction hit builder allows you to send in-app purchases and sales to Google Analytics. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
[Expand]
Inherited Methods | |||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
![]() |