java.lang.Object |
↳ |
com.google.android.gms.analytics.ecommerce.Product |
Class Overview
Class to construct product related information for a Google Analytics hit. Use this class to
report information about products sold by merchants or impressions of products seen by users.
Instances of this class can be associated with both ProductActions via
addProduct(Product)
and Product
Impressions via
addImpression(Product, String)
.
Typical usage:
ScreenViewBuilder builder = new HitBuilders.ScreenViewBuilder();
builder.addImpression(
new Product()
.setId("PID-1234")
.setName("Space Monkeys!")
.setPrice(100), "listName");
builder.setProductAction(
new ProductAction(ProductAction.ACTION_PURCHASE))
.addProduct(new Product().setId("PID-4321").setName("Water Monkeys!"));
tracker.send(builder.build());
Summary
[Expand]
Inherited Methods |
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
|
Public Constructors
Public Methods
public
Product
setBrand
(String value)
Sets the brand associated with the product in GA reports.
Parameters |
value |
String :
The product's brand. Example: "Acme Toys" |
Returns |
Product |
Returns the same object to enable chaining of methods.
|
public
Product
setCategory
(String value)
Sets the category associated with the product in GA reports.
Parameters |
value |
String :
The product's category. Example: "Toys" |
Returns |
Product |
Returns the same object to enable chaining of methods.
|
public
Product
setCouponCode
(String value)
Sets the coupon code associated with the product. This field is usually not used with
product impressions.
Parameters |
value |
String :
The product's coupon code. Example: "EXTRA10" |
Returns |
Product |
Returns the same object to enable chaining of methods.
|
public
Product
setCustomDimension
(int index, String value)
Sets the custom dimensions associated with the product.
Parameters |
index |
int :
The dimension's index as configured in Google Analytics Account. Example: 3 |
value |
String :
The product's custom dimension. Example: "Foo Reseller" |
Returns |
Product |
Returns the same object to enable chaining of methods.
|
public
Product
setCustomMetric
(int index, int value)
Sets the custom metrics associated with the product.
Parameters |
index |
int :
The metric's index as configured in Google Analytics Account. Example: 4 |
value |
int :
The product's custom metric. Example: 5 |
Returns |
Product |
Returns the same object to enable chaining of methods.
|
public
Product
setId
(String value)
Sets the id that is used to identify a product in GA reports.
Parameters |
value |
String :
The product id. |
Returns |
Product |
Returns the same object to enable chaining of methods.
|
public
Product
setName
(String value)
Sets the name that is used to identify the product in GA reports.
Parameters |
value |
String :
The product's name. Example: "Space Monkeys" |
Returns |
Product |
Returns the same object to enable chaining of methods.
|
public
Product
setPosition
(int value)
Sets the position of the product on the page/product impression list etc.
Parameters |
value |
int :
The product's position. Example: 1 or 30 |
Returns |
Product |
Returns the same object to enable chaining of methods.
|
public
Product
setPrice
(double value)
Sets the price of the product.
Parameters |
value |
double :
The product's price. Example: 3.14 |
Returns |
Product |
Returns the same object to enable chaining of methods.
|
public
Product
setQuantity
(int value)
Sets the quantity of the product. This field is usually not used with product impressions.
Parameters |
value |
int :
The product's quantity. Example: 42 |
Returns |
Product |
Returns the same object to enable chaining of methods.
|
public
Product
setVariant
(String value)
Sets the variant of the product.
Parameters |
value |
String :
The product's variant. Example: "Yellow" or "Red" |
Returns |
Product |
Returns the same object to enable chaining of methods.
|
public
String
toString
()