All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.brsanthu.googleanalytics.request.ItemHit Maven / Gradle / Ivy

/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.brsanthu.googleanalytics.request;

import static com.brsanthu.googleanalytics.internal.Constants.HIT_ITEM;
import static com.brsanthu.googleanalytics.request.GoogleAnalyticsParameter.CURRENCY_CODE;
import static com.brsanthu.googleanalytics.request.GoogleAnalyticsParameter.ITEM_CATEGORY;
import static com.brsanthu.googleanalytics.request.GoogleAnalyticsParameter.ITEM_CODE;
import static com.brsanthu.googleanalytics.request.GoogleAnalyticsParameter.ITEM_NAME;
import static com.brsanthu.googleanalytics.request.GoogleAnalyticsParameter.ITEM_PRICE;
import static com.brsanthu.googleanalytics.request.GoogleAnalyticsParameter.ITEM_QUANTITY;
import static com.brsanthu.googleanalytics.request.GoogleAnalyticsParameter.TRANSACTION_ID;

/**
 * GA request to track items as part of ecommerce transaction.
 *
 * 

* For more information, see * GA Parameters * Reference *

* * @author Santhosh Kumar */ public class ItemHit extends GoogleAnalyticsRequest { public ItemHit() { super(HIT_ITEM); } /** *
*

* Required for transaction hit type.
* Required for item hit type. *

*

* A unique identifier for the transaction. This value should be the same for both the Transaction hit and Items * hits associated to the particular transaction. *

* * * * * * * * * * * * * * * * * *
ParameterValue TypeDefault ValueMax LengthSupported Hit Types
titextNone500 Bytestransaction, item
*
Example value: OD564
* Example usage: ti=OD564
*/ public ItemHit txId(String value) { setString(TRANSACTION_ID, value); return this; } public String txId() { return getString(TRANSACTION_ID); } /** *
*

* Required for item hit type. *

*

* Specifies the item name. *

* * * * * * * * * * * * * * * * * *
ParameterValue TypeDefault ValueMax LengthSupported Hit Types
intextNone500 Bytesitem
*
Example value: Shoe
* Example usage: in=Shoe
*/ public ItemHit itemName(String value) { setString(ITEM_NAME, value); return this; } public String itemName() { return getString(ITEM_NAME); } /** *
*

* Optional. *

*

* Specifies the price for a single item / unit. *

* * * * * * * * * * * * * * * * * *
ParameterValue TypeDefault ValueMax LengthSupported Hit Types
ipcurrency0Noneitem
*
Example value: 3.50
* Example usage: ip=3.50
*/ public ItemHit itemPrice(Double value) { setDouble(ITEM_PRICE, value); return this; } public Double itemPrice() { return getDouble(ITEM_PRICE); } /** *
*

* Optional. *

*

* Specifies the number of items purchased. *

* * * * * * * * * * * * * * * * * *
ParameterValue TypeDefault ValueMax LengthSupported Hit Types
iqinteger0Noneitem
*
Example value: 4
* Example usage: iq=4
*/ public ItemHit itemQuantity(Integer value) { setInteger(ITEM_QUANTITY, value); return this; } public Integer itemQuantity() { return getInteger(ITEM_QUANTITY); } /** *
*

* Optional. *

*

* Specifies the SKU or item code. *

* * * * * * * * * * * * * * * * * *
ParameterValue TypeDefault ValueMax LengthSupported Hit Types
ictextNone500 Bytesitem
*
Example value: SKU47
* Example usage: ic=SKU47
*/ public ItemHit itemCode(String value) { setString(ITEM_CODE, value); return this; } public String itemCode() { return getString(ITEM_CODE); } /** *
*

* Optional. *

*

* Specifies the category that the item belongs to. *

* * * * * * * * * * * * * * * * * *
ParameterValue TypeDefault ValueMax LengthSupported Hit Types
ivtextNone500 Bytesitem
*
Example value: Blue
* Example usage: iv=Blue
*/ public ItemHit itemCategory(String value) { setString(ITEM_CATEGORY, value); return this; } public String itemCategory() { return getString(ITEM_CATEGORY); } /** *
*

* Optional. *

*

* When present indicates the local currency for all transaction currency values. Value should be a valid ISO 4217 * currency code. *

* * * * * * * * * * * * * * * * * *
ParameterValue TypeDefault ValueMax LengthSupported Hit Types
cutextNone10 Bytestransaction, item
*
Example value: EUR
* Example usage: cu=EUR
*/ public ItemHit currencyCode(String value) { setString(CURRENCY_CODE, value); return this; } public String currencyCode() { return getString(CURRENCY_CODE); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy