PHP Class TheIconic\Tracking\GoogleAnalytics\Analytics

The main interface for the clients, it relies heavily in magic methods exposing an interface with method tags. ==== GETTERS ==== General
Exibir arquivo Open project: theiconic/php-ga-measurement-protocol Class Usage Examples

Public Methods

Method Description
__call ( $methodName, array $methodArguments ) : mixed Routes the method call to the adequate private method.
__construct ( boolean $isSsl = false ) When passed with an argument of TRUE, it will send the hit using HTTPS instead of plain HTTP.
getUrl ( ) : string Build and returns URL used to send to Google Analytics.
makeNonBlocking ( ) Makes the request to GA asynchronous (non-blocking).
setAsyncRequest ( boolean $isAsyncRequest ) Sets a request to be either synchronous or asynchronous (non-blocking).
setDebug ( boolean $value ) : Analytics Sets debug mode to true or false.
setHttpClient ( HttpClient $httpClient ) Sets the HttpClient.

Private Methods

Method Description
addItem ( $methodName, array $methodArguments ) Adds an item to a compund parameter collection.
fixTypos ( string $methodName ) : string Fix typos that went into releases, this way we ensure we don't break scripts in production.
getEndpoint ( ) : string Gets the full endpoint to GA.
getFullParameterClass ( $parameterClass, $methodName ) : string Gets the fully qualified name for a parameter.
getHttpClient ( ) : HttpClient Gets the HttpClient.
getIndexFromArguments ( $methodArguments ) : string Gets the index value from the arguments.
getParameter ( $methodName, array $methodArguments ) : string Gets the value for a parameter.
getParameterClassConstant ( $constant, $exceptionMsg ) : mixed Gets a contant from a class dynamically.
hasMinimumRequiredParameters ( ) : boolean Validates the minimum required parameters for every GA hit are being sent.
sendHit ( $methodName ) : AnalyticsResponse Sends a hit to GA. The hit will contain in the payload all the parameters added before.
setParameter ( $methodName, array $methodArguments ) Sets the value for a parameter.
setParameterActionTo ( $parameter, $action ) Sets a parameter action to the value specified by the method call.

Method Details

__call() public method

Routes the method call to the adequate private method.
public __call ( $methodName, array $methodArguments ) : mixed
$methodName
$methodArguments array
return mixed

__construct() public method

It parses the available parameters.
public __construct ( boolean $isSsl = false )
$isSsl boolean

getUrl() public method

Build and returns URL used to send to Google Analytics.
public getUrl ( ) : string
return string

makeNonBlocking() public method

Makes the request to GA asynchronous (non-blocking).
Deprecation: Use setAsyncRequest(boolean $isAsyncRequest) instead. To be removed in next major version.
public makeNonBlocking ( )

setAsyncRequest() public method

Sets a request to be either synchronous or asynchronous (non-blocking).
public setAsyncRequest ( boolean $isAsyncRequest )
$isAsyncRequest boolean

setDebug() public method

Sets debug mode to true or false.
public setDebug ( boolean $value ) : Analytics
$value boolean
return Analytics

setHttpClient() public method

Sets the HttpClient.
public setHttpClient ( HttpClient $httpClient )
$httpClient TheIconic\Tracking\GoogleAnalytics\Network\HttpClient