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

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

Go to download

This is Java API for Google Analytics (Measurement Protocol). More information about the protocol is available at https://developers.google.com/analytics/devguides/collection/protocol/v1/.

There is a newer version: 2.0.0
Show newest version
/*
 * 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;

import static com.brsanthu.googleanalytics.GoogleAnalyticsParameter.CURRENCY_CODE;
import static com.brsanthu.googleanalytics.GoogleAnalyticsParameter.ITEM_CATEGORY;
import static com.brsanthu.googleanalytics.GoogleAnalyticsParameter.ITEM_CODE;
import static com.brsanthu.googleanalytics.GoogleAnalyticsParameter.ITEM_NAME;
import static com.brsanthu.googleanalytics.GoogleAnalyticsParameter.ITEM_PRICE;
import static com.brsanthu.googleanalytics.GoogleAnalyticsParameter.ITEM_QUANTITY;
import static com.brsanthu.googleanalytics.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("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
titextNone * 500 Bytes * transaction, 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
intextNone * 500 Bytes * item
*
* 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
ipcurrency0 * None * item
*
* 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
iqinteger0 * None * item
*
* 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
ictextNone * 500 Bytes * item
*
* 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
ivtextNone * 500 Bytes * item
*
* 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
cutextNone * 10 Bytes * transaction, 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