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
HitBuilders.HitBuilder.addProduct(Product) and Product Impressions via
HitBuilders.HitBuilder.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());
|
Product()
|
| Product | |
| Product | |
| Product | |
| Product | |
| Product |
setCustomMetric(int index, int value)
Sets the custom metrics associated with the product.
|
| Product | |
| Product | |
| Product |
setPosition(int value)
Sets the position of the product on the page/product impression list etc.
|
| Product |
setPrice(double value)
Sets the price of the product.
|
| Product |
setQuantity(int value)
Sets the quantity of the product.
|
| Product | |
| String |
toString()
|
Sets the brand associated with the product in GA reports.
| value | The product's brand. Example: "Acme Toys" |
|---|
Sets the category associated with the product in GA reports.
| value | The product's category. Example: "Toys" |
|---|
Sets the coupon code associated with the product. This field is usually not used with product impressions.
| value | The product's coupon code. Example: "EXTRA10" |
|---|
Sets the custom dimensions associated with the product.
| index | The dimension's index as configured in Google Analytics Account. Example: 3 |
|---|---|
| value | The product's custom dimension. Example: "Foo Reseller" |
Sets the custom metrics associated with the product.
| index | The metric's index as configured in Google Analytics Account. Example: 4 |
|---|---|
| value | The product's custom metric. Example: 5 |
Sets the id that is used to identify a product in GA reports.
| value | The product id. |
|---|
Sets the name that is used to identify the product in GA reports.
| value | The product's name. Example: "Space Monkeys" |
|---|
Sets the position of the product on the page/product impression list etc.
| value | The product's position. Example: 1 or 30 |
|---|
Sets the price of the product.
| value | The product's price. Example: 3.14 |
|---|
Sets the quantity of the product. This field is usually not used with product impressions.
| value | The product's quantity. Example: 42 |
|---|
Sets the variant of the product.
| value | The product's variant. Example: "Yellow" or "Red" |
|---|