com.brsanthu.googleanalytics.TimingHit Maven / Gradle / Ivy
Show all versions of google-analytics-java Show documentation
/*
* 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.DNS_TIME;
import static com.brsanthu.googleanalytics.GoogleAnalyticsParameter.PAGE_DOWNLOAD_TIME;
import static com.brsanthu.googleanalytics.GoogleAnalyticsParameter.PAGE_LOAD_TIME;
import static com.brsanthu.googleanalytics.GoogleAnalyticsParameter.REDIRECT_RESPONSE_TIME;
import static com.brsanthu.googleanalytics.GoogleAnalyticsParameter.SERVER_RESPONSE_TIME;
import static com.brsanthu.googleanalytics.GoogleAnalyticsParameter.TCP_CONNECT_TIME;
import static com.brsanthu.googleanalytics.GoogleAnalyticsParameter.USER_TIMING_CATEGORY;
import static com.brsanthu.googleanalytics.GoogleAnalyticsParameter.USER_TIMING_LABEL;
import static com.brsanthu.googleanalytics.GoogleAnalyticsParameter.USER_TIMING_TIME;
import static com.brsanthu.googleanalytics.GoogleAnalyticsParameter.USER_TIMING_VARIABLE_NAME;
/**
* GA request to track performance timings like page load time, server response time etc.
*
* For more information, see GA Parameters Reference
*
* @author Santhosh Kumar
*/
public class TimingHit extends GoogleAnalyticsRequest {
public TimingHit() {
super("timing");
}
/**
*
*
* Optional.
*
* Specifies the user timing category.
*
*
*
* Parameter
* Value Type
* Default Value
* Max Length
* Supported Hit Types
*
*
* utc
* text
* None
*
* 150 Bytes
*
* timing
*
*
*
*
* Example value: category
* Example usage: utc=category
*
*
*/
public TimingHit userTimingCategory(String value) {
setString(USER_TIMING_CATEGORY, value);
return this;
}
public String userTimingCategory() {
return getString(USER_TIMING_CATEGORY);
}
/**
*
*
* Optional.
*
* Specifies the user timing variable.
*
*
*
* Parameter
* Value Type
* Default Value
* Max Length
* Supported Hit Types
*
*
* utv
* text
* None
*
* 500 Bytes
*
* timing
*
*
*
*
* Example value: lookup
* Example usage: utv=lookup
*
*
*/
public TimingHit userTimingVariableName(String value) {
setString(USER_TIMING_VARIABLE_NAME, value);
return this;
}
public String userTimingVariableName() {
return getString(USER_TIMING_VARIABLE_NAME);
}
/**
*
*
* Optional.
*
* Specifies the user timing value. The value is in milliseconds.
*
*
*
* Parameter
* Value Type
* Default Value
* Max Length
* Supported Hit Types
*
*
* utt
* integer
* None
*
* None
*
* timing
*
*
*
*
* Example value: 123
* Example usage: utt=123
*
*
*/
public TimingHit userTimingTime(Integer value) {
setInteger(USER_TIMING_TIME, value);
return this;
}
public Integer userTimingTime() {
return getInteger(USER_TIMING_TIME);
}
/**
*
*
* Optional.
*
* Specifies the user timing label.
*
*
*
* Parameter
* Value Type
* Default Value
* Max Length
* Supported Hit Types
*
*
* utl
* text
* None
*
* 500 Bytes
*
* timing
*
*
*
*
* Example value: label
* Example usage: utl=label
*
*
*/
public TimingHit userTimingLabel(String value) {
setString(USER_TIMING_LABEL, value);
return this;
}
public String userTimingLabel() {
return getString(USER_TIMING_LABEL);
}
/**
*
*
* Optional.
*
* Specifies the time it took for a page to load. The value is in milliseconds.
*
*
*
* Parameter
* Value Type
* Default Value
* Max Length
* Supported Hit Types
*
*
* plt
* integer
* None
*
* None
*
* timing
*
*
*
*
* Example value: 3554
* Example usage: plt=3554
*
*
*/
public TimingHit pageLoadTime(Integer value) {
setInteger(PAGE_LOAD_TIME, value);
return this;
}
public Integer pageLoadTime() {
return getInteger(PAGE_LOAD_TIME);
}
/**
*
*
* Optional.
*
* Specifies the time it took to do a DNS lookup.The value is in milliseconds.
*
*
*
* Parameter
* Value Type
* Default Value
* Max Length
* Supported Hit Types
*
*
* dns
* integer
* None
*
* None
*
* timing
*
*
*
*
* Example value: 43
* Example usage: dns=43
*
*
*/
public TimingHit dnsTime(Integer value) {
setInteger(DNS_TIME, value);
return this;
}
public Integer dnsTime() {
return getInteger(DNS_TIME);
}
/**
*
*
* Optional.
*
* Specifies the time it took for the page to be downloaded. The value is in milliseconds.
*
*
*
* Parameter
* Value Type
* Default Value
* Max Length
* Supported Hit Types
*
*
* pdt
* integer
* None
*
* None
*
* timing
*
*
*
*
* Example value: 500
* Example usage: pdt=500
*
*
*/
public TimingHit pageDownloadTime(Integer value) {
setInteger(PAGE_DOWNLOAD_TIME, value);
return this;
}
public Integer pageDownloadTime() {
return getInteger(PAGE_DOWNLOAD_TIME);
}
/**
*
*
* Optional.
*
* Specifies the time it took for any redirects to happen. The value is in milliseconds.
*
*
*
* Parameter
* Value Type
* Default Value
* Max Length
* Supported Hit Types
*
*
* rrt
* integer
* None
*
* None
*
* timing
*
*
*
*
* Example value: 500
* Example usage: rrt=500
*
*
*/
public TimingHit redirectResponseTime(Integer value) {
setInteger(REDIRECT_RESPONSE_TIME, value);
return this;
}
public Integer redirectResponseTime() {
return getInteger(REDIRECT_RESPONSE_TIME);
}
/**
*
*
* Optional.
*
* Specifies the time it took for a TCP connection to be made. The value is in milliseconds.
*
*
*
* Parameter
* Value Type
* Default Value
* Max Length
* Supported Hit Types
*
*
* tcp
* integer
* None
*
* None
*
* timing
*
*
*
*
* Example value: 500
* Example usage: tcp=500
*
*
*/
public TimingHit tcpConnectTime(Integer value) {
setInteger(TCP_CONNECT_TIME, value);
return this;
}
public Integer tcpConnectTime() {
return getInteger(TCP_CONNECT_TIME);
}
/**
*
*
* Optional.
*
* Specifies the time it took for the server to respond after the connect time. The value is in milliseconds.
*
*
*
* Parameter
* Value Type
* Default Value
* Max Length
* Supported Hit Types
*
*
* srt
* integer
* None
*
* None
*
* timing
*
*
*
*
* Example value: 500
* Example usage: srt=500
*
*
*/
public TimingHit serverResponseTime(Integer value) {
setInteger(SERVER_RESPONSE_TIME, value);
return this;
}
public Integer serverResponseTime() {
return getInteger(SERVER_RESPONSE_TIME);
}
}