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

com.brsanthu.googleanalytics.SocialHit 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.SOCIAL_ACTION;
import static com.brsanthu.googleanalytics.GoogleAnalyticsParameter.SOCIAL_ACTION_TARGET;
import static com.brsanthu.googleanalytics.GoogleAnalyticsParameter.SOCIAL_NETWORK;

/**
 * GA request to track social interactions
 *
 * 

For more information, see GA Parameters Reference

* * @author Santhosh Kumar */ public class SocialHit extends GoogleAnalyticsRequest { public SocialHit() { this(null, null, null); } public SocialHit(String socialNetwork, String socialAction, String socialTarget) { super("social"); socialAction(socialAction); socialNetwork(socialNetwork); socialActionTarget(socialTarget); } /** *
*

* Required for social hit type. *

*

Specifies the social network, for example Facebook or Google Plus.

* * * * * * * * * * * * * * * * * *
ParameterValue TypeDefault ValueMax LengthSupported Hit Types
sntextNone * 50 Bytes * social
*
* Example value: facebook
* Example usage: sn=facebook *
*
*/ public SocialHit socialNetwork(String value) { setString(SOCIAL_NETWORK, value); return this; } public String socialNetwork() { return getString(SOCIAL_NETWORK); } /** *
*

* Required for social hit type. *

*

Specifies the social interaction action. For example on Google Plus when a user clicks the +1 button, the social action is 'plus'.

* * * * * * * * * * * * * * * * * *
ParameterValue TypeDefault ValueMax LengthSupported Hit Types
satextNone * 50 Bytes * social
*
* Example value: like
* Example usage: sa=like *
*
*/ public SocialHit socialAction(String value) { setString(SOCIAL_ACTION, value); return this; } public String socialAction() { return getString(SOCIAL_ACTION); } /** *
*

* Required for social hit type. *

*

Specifies the target of a social interaction. This value is typically a URL but can be any text.

* * * * * * * * * * * * * * * * * *
ParameterValue TypeDefault ValueMax LengthSupported Hit Types
sttextNone * 2048 Bytes * social
*
* Example value: http://foo.com
* Example usage: st=http%3A%2F%2Ffoo.com *
*
*/ public SocialHit socialActionTarget(String value) { setString(SOCIAL_ACTION_TARGET, value); return this; } public String socialActionTarget() { return getString(SOCIAL_ACTION_TARGET); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy