Class to construct transaction/checkout or other product interaction related information
for a Google Analytics hit. Use this class to report information about products sold, viewed
or refunded. This class is intended to be used with Product.
Instances of this class can be associated with
HitBuilders.HitBuilder.setProductAction(ProductAction).
Typical usage:
HitBuilders.ScreenViewBuilder builder = new HitBuilders.ScreenViewBuilder();
builder.setProductAction(
new ProductAction(ProductAction.ACTION_PURCHASE)
.setTransactionId("TT-1234")
.setTransactionRevenue(3.14)
.setTransactionCouponCode("EXTRA100"))
.addProduct(new Product().setId("PID-4321").setName("Water Monkeys!"));
tracker.send(builder.build());
| String | ACTION_ADD | Action to use when a product is added to the cart. |
| String | ACTION_CHECKOUT | Action to use for hits with checkout data. |
| String | ACTION_CHECKOUT_OPTION | Action to be used for supplemental checkout data that needs to be provided after a checkout hit. |
| String | ACTION_CHECKOUT_OPTIONS | This constant is deprecated. Use
ACTION_CHECKOUT_OPTION instead. |
| String | ACTION_CLICK | Action to use when the user clicks on a set of products. |
| String | ACTION_DETAIL | Action to use when the user views detailed descriptions of products. |
| String | ACTION_PURCHASE | Action that is used to report all the transaction data to GA. |
| String | ACTION_REFUND | Action to use while reporting refunded transactions to GA. |
| String | ACTION_REMOVE | Action to use when a product is removed from the cart. |
| ProductAction | |
| ProductAction |
setCheckoutStep(int value)
Sets the checkout processes's progress.
|
| ProductAction |
setProductActionList(String value)
Sets the list name associated with the products in the analytics hit.
|
| ProductAction |
setProductListSource(String value)
Sets the list source name associated with the products in the analytics hit.
|
| ProductAction | |
| ProductAction | |
| ProductAction | |
| ProductAction |
setTransactionRevenue(double value)
Sets the transaction's total revenue.
|
| ProductAction |
setTransactionShipping(double value)
Sets the transaction's shipping costs.
|
| ProductAction |
setTransactionTax(double value)
Sets the transaction's total tax.
|
| String |
toString()
|
Action to use when a product is added to the cart.
Action to use for hits with checkout data. This action can have accompanying fields
like checkout step
setCheckoutStep(int), checkout label
setCheckoutOptions(String) and checkout options
setCheckoutOptions(String).
Action to be used for supplemental checkout data that needs to be provided after a checkout hit. This action can additionally have the same fields as the checkout action.
This constant is deprecated.
Use
ACTION_CHECKOUT_OPTION instead.
Action to be used for supplemental checkout data that needs to be provided after a checkout hit. This action can additionally have the same fields as the checkout action.
Action to use when the user clicks on a set of products. This action can have
accompanying fields like product action list name
setProductActionList(String) and product list source
setProductListSource(String).
Action to use when the user views detailed descriptions of products. This action can
have accompanying fields like product action list name
setProductActionList(String) and product list source
setProductListSource(String).
Action that is used to report all the transaction data to GA. This is equivalent to the transaction hit type which was available in previous versions of the SDK. This action can can also have accompanying fields like transaction id, affiliation, revenue, tax, shipping and coupon code. These fields can be specified with methods defined in this class.
Action to use while reporting refunded transactions to GA.
Action to use when a product is removed from the cart.
Sets the product action for all the products included in the hit. Valid values include "detail", "click", "add", "remove", "checkout", "checkout_option", "purchase" and "refund". All these values are also defined in this class for ease of use. You also also send additional values with the hit for some specific actions. See the action documentation for details.
| action | The value of product action. |
|---|
Sets the label associated with the checkout. This value is used with
ACTION_CHECKOUT and
ACTION_CHECKOUT_OPTION actions.
| value | A string label/option associated with the checkout. |
|---|
Sets the checkout processes's progress. This value is used with
ACTION_CHECKOUT and
ACTION_CHECKOUT_OPTION actions.
| value | An integer representing the progress of the checkout flow. example: 4 or 5. |
|---|
Sets the list name associated with the products in the analytics hit. This value is
used with
ACTION_DETAIL and
ACTION_CLICK actions.
| value | A string name identifying the product list. |
|---|
Sets the list source name associated with the products in the analytics hit. This
value is used with
ACTION_DETAIL and
ACTION_CLICK actions.
| value | A string name identifying the product list's source. |
|---|
Sets the transaction's affiliation value. This value is used for
ACTION_PURCHASE and
ACTION_REFUND actions.
| value | A string identifying the transaction affiliation. |
|---|
Sets the coupon code used in a transaction. This value is used for
ACTION_PURCHASE and
ACTION_REFUND actions.
| value | A string representing the coupon code used in a transaction. |
|---|
The unique id associated with the transaction. This value is used for
ACTION_PURCHASE and
ACTION_REFUND actions.
| value | A string id identifying a transaction |
|---|
Sets the transaction's total revenue. This value is used for
ACTION_PURCHASE and
ACTION_REFUND actions.
| value | A number representing the revenue from a transaction. |
|---|
Sets the transaction's shipping costs. This value is used for
ACTION_PURCHASE and
ACTION_REFUND actions.
| value | A number representing the shipping costs from a transaction. |
|---|
Sets the transaction's total tax. This value is used for
ACTION_PURCHASE and
ACTION_REFUND actions.
| value | A number representing the revenue from a transaction. |
|---|