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

com.brsanthu.googleanalytics.request.EventHit 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_EVENT;
import static com.brsanthu.googleanalytics.request.GoogleAnalyticsParameter.EVENT_ACTION;
import static com.brsanthu.googleanalytics.request.GoogleAnalyticsParameter.EVENT_CATEGORY;
import static com.brsanthu.googleanalytics.request.GoogleAnalyticsParameter.EVENT_LABEL;
import static com.brsanthu.googleanalytics.request.GoogleAnalyticsParameter.EVENT_VALUE;

/**
 * GA request to track events.
 *
 * 

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

* * @author Santhosh Kumar */ public class EventHit extends GoogleAnalyticsRequest { public EventHit() { this(null, null, null, null); } public EventHit(String eventCategory, String eventAction) { this(eventCategory, eventAction, null, null); } public EventHit(String eventCategory, String eventAction, String eventLabel, Integer eventValue) { super(HIT_EVENT); eventCategory(eventCategory); eventAction(eventAction); eventLabel(eventLabel); eventValue(eventValue); } /** *

Event Tracking

*

* Optional. *

*

* Specifies the event category. Must not be empty. *

* * * * * * * * * * * * * * * * * *
ParameterValue TypeDefault ValueMax LengthSupported Hit Types
ectextNone150 Bytesevent
*
Example value: Category
* Example usage: ec=Category
*/ public EventHit eventCategory(String value) { setString(EVENT_CATEGORY, value); return this; } public String eventCategory() { return getString(EVENT_CATEGORY); } /** *
*

* Optional. *

*

* Specifies the event action. Must not be empty. *

* * * * * * * * * * * * * * * * * *
ParameterValue TypeDefault ValueMax LengthSupported Hit Types
eatextNone500 Bytesevent
*
Example value: Action
* Example usage: ea=Action
*/ public EventHit eventAction(String value) { setString(EVENT_ACTION, value); return this; } public String eventAction() { return getString(EVENT_ACTION); } /** *
*

* Optional. *

*

* Specifies the event label. *

* * * * * * * * * * * * * * * * * *
ParameterValue TypeDefault ValueMax LengthSupported Hit Types
eltextNone500 Bytesevent
*
Example value: Label
* Example usage: el=Label
*/ public EventHit eventLabel(String value) { setString(EVENT_LABEL, value); return this; } public String eventLabel() { return getString(EVENT_LABEL); } /** *
*

* Optional. *

*

* Specifies the event value. Values must be non-negative. *

* * * * * * * * * * * * * * * * * *
ParameterValue TypeDefault ValueMax LengthSupported Hit Types
evintegerNoneNoneevent
*
Example value: 55
* Example usage: ev=55
*/ public EventHit eventValue(Integer value) { setInteger(EVENT_VALUE, value); return this; } public Integer eventValue() { return getInteger(EVENT_VALUE); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy