GoogleAnalyticsRefreshService
in package
Class GoogleAnalyticsRefreshService
Table of Contents
- $dataCacheKey : string
- $httpClient : Client
- $options : GoogleAnalyticsRefreshServiceOptionsInterface
- $readService : GoogleAnalyticsConfigurationReadServiceInterface
- __construct() : mixed
- GoogleAnalyticsRefreshService constructor.
- create() : GoogleAnalyticsRefreshService
- Named constructor of google analytics refresh service.
- updateAnalyticsIfNecessary() : mixed
- Updates the google analytics shop files, if they are older than one day.
- _downloadAnalyticsJs() : $this
- Downloads and modifies the google analytics javascript file.
- _downloadECommercePlugin() : $this
- Downloads the google analytics e-commerce plugin file.
- _downloadGTagJs() : $this
- Downloads and modifies the gtag javascript file.
Properties
$dataCacheKey
private
string
$dataCacheKey
= 'analytics_js_expires_at'
$httpClient
private
Client
$httpClient
$options
private
GoogleAnalyticsRefreshServiceOptionsInterface
$options
$readService
private
GoogleAnalyticsConfigurationReadServiceInterface
$readService
Methods
__construct()
GoogleAnalyticsRefreshService constructor.
public
__construct(GoogleAnalyticsRefreshServiceOptionsInterface $options, Client $httpClient, GoogleAnalyticsConfigurationReadServiceInterface $readService) : mixed
Parameters
- $options : GoogleAnalyticsRefreshServiceOptionsInterface
-
Refresh service options.
- $httpClient : Client
-
Http client.
- $readService : GoogleAnalyticsConfigurationReadServiceInterface
-
GA config read service.
Return values
mixed —create()
Named constructor of google analytics refresh service.
public
static create(GoogleAnalyticsRefreshServiceOptionsInterface $options[, Client|null $httpClient = null ][, GoogleAnalyticsConfigurationReadServiceInterface|null $readService = null ]) : GoogleAnalyticsRefreshService
Parameters
- $options : GoogleAnalyticsRefreshServiceOptionsInterface
-
Refresh service options.
- $httpClient : Client|null = null
-
(Optional) Http client.
- $readService : GoogleAnalyticsConfigurationReadServiceInterface|null = null
-
(Optional) GA config read service.
Return values
GoogleAnalyticsRefreshService —New instance.
updateAnalyticsIfNecessary()
Updates the google analytics shop files, if they are older than one day.
public
updateAnalyticsIfNecessary() : mixed
Return values
mixed —_downloadAnalyticsJs()
Downloads and modifies the google analytics javascript file.
private
_downloadAnalyticsJs() : $this
After downloading the file, the https://www.google-analytics.com/ endpoints got modified and will be proxied through the shop.
Return values
$this —Same instance for chained method calls.
_downloadECommercePlugin()
Downloads the google analytics e-commerce plugin file.
private
_downloadECommercePlugin() : $this
Return values
$this —Same instance for chained method calls.
_downloadGTagJs()
Downloads and modifies the gtag javascript file.
private
_downloadGTagJs(GoogleAnalyticsUaTrackingCode $trackingCode) : $this
After downloading the file, the https://www.google-analytics.com/ endpoints got modified and will be proxied through the shop.
Parameters
- $trackingCode : GoogleAnalyticsUaTrackingCode
-
UA-Tracking code (will be append to the gtag source).