class JGoogleEmbedAnalytics extends JGoogleEmbed

Google Analytics embed class for the Joomla Platform.

Methods

__construct( Registry $options = null, JUri $uri = null)

Constructor.

string
isSecure()

Method to retrieve the javascript header for the embed API

string
getHeader()

Get code to load Google Analytics javascript

string
getBody()

Google Analytics only needs to be included in the header

null
echoHeader()

Method to output the javascript header for the embed API

null
echoBody()

Method to output the body for the API

mixed
getOption( string $key)

Get an option from the JGoogleEmbed instance.

setOption( string $key, mixed $value)

Set an option for the JGoogleEmbed instance.

string
getCode()

Method to get the tracking code

setCode( string $code)

Method to set the tracking code

boolean
isAsync()

Checks if the javascript is set to be asynchronous

useAsync()

Load javascript asynchronously

useSync()

Load javascript synchronously

array
addCall( string $method, array $params = array())

Add an analytics call

array
listCalls()

List the analytics calls to be executed

array
deleteCall( int $index = null)

Delete a call from the stack

string
createCall( string $method, array $params = array())

Create a javascript function from the call parameters

array
addCustomVar( int $slot, string $name, string $value, int $scope = 3)

Add a custom variable to the analytics

string
createCustomVar( int $slot, string $name, string $value, int $scope = 3)

Get the code to create a custom analytics variable

array
addEvent( string $category, string $action, string $label = null, string $value = null, boolean $noninteract = false)

Track an analytics event

string
createEvent( string $category, string $action, string $label = null, string $value = null, boolean $noninteract = false)

Get the code to track an analytics event

Details

__construct( Registry $options = null, JUri $uri = null)

Constructor.

Parameters

Registry $options Google options object
JUri $uri URL of the page being rendered

string isSecure()

Method to retrieve the javascript header for the embed API

Return Value

string The header

string getHeader()

Get code to load Google Analytics javascript

Return Value

string The header

string getBody()

Google Analytics only needs to be included in the header

Return Value

string The body

null echoHeader()

Method to output the javascript header for the embed API

Return Value

null

null echoBody()

Method to output the body for the API

Return Value

null

mixed getOption( string $key)

Get an option from the JGoogleEmbed instance.

Parameters

string $key The name of the option to get.

Return Value

mixed The option value.

JGoogleEmbed setOption( string $key, mixed $value)

Set an option for the JGoogleEmbed instance.

Parameters

string $key The name of the option to set.
mixed $value The option value to set.

Return Value

JGoogleEmbed This object for method chaining.

string getCode()

Method to get the tracking code

Return Value

string The Google Analytics tracking code

JGoogleEmbedAnalytics setCode( string $code)

Method to set the tracking code

Parameters

string $code The Google Analytics tracking code

Return Value

JGoogleEmbedAnalytics The object for method chaining

boolean isAsync()

Checks if the javascript is set to be asynchronous

Return Value

boolean True if asynchronous

JGoogleEmbedAnalytics useAsync()

Load javascript asynchronously

Return Value

JGoogleEmbedAnalytics The object for method chaining

JGoogleEmbedAnalytics useSync()

Load javascript synchronously

Return Value

JGoogleEmbedAnalytics The object for method chaining

array addCall( string $method, array $params = array())

Add an analytics call

Parameters

string $method The name of the function
array $params The parameters for the call

Return Value

array The added call

array listCalls()

List the analytics calls to be executed

Return Value

array A list of calls

array deleteCall( int $index = null)

Delete a call from the stack

Parameters

int $index Index of call to delete (defaults to last added call)

Return Value

array The deleted call

string createCall( string $method, array $params = array())

Create a javascript function from the call parameters

Parameters

string $method The name of the function
array $params The parameters for the call

Return Value

string The created call

array addCustomVar( int $slot, string $name, string $value, int $scope = 3)

Add a custom variable to the analytics

Parameters

int $slot The slot to store the variable in (1-5)
string $name The variable name
string $value The variable value
int $scope The scope of the variable (1: visitor level, 2: session level, 3: page level)

Return Value

array The added call

string createCustomVar( int $slot, string $name, string $value, int $scope = 3)

Get the code to create a custom analytics variable

Parameters

int $slot The slot to store the variable in (1-5)
string $name The variable name
string $value The variable value
int $scope The scope of the variable (1: visitor level, 2: session level, 3: page level)

Return Value

string The created call

array addEvent( string $category, string $action, string $label = null, string $value = null, boolean $noninteract = false)

Track an analytics event

Parameters

string $category The general event category
string $action The event action
string $label The event description
string $value The value of the event
boolean $noninteract Don't allow this event to impact bounce statistics

Return Value

array The added call

string createEvent( string $category, string $action, string $label = null, string $value = null, boolean $noninteract = false)

Get the code to track an analytics event

Parameters

string $category The general event category
string $action The event action
string $label The event description
string $value The value of the event
boolean $noninteract Don't allow this event to impact bounce statistics

Return Value

string The created call