Internetrix\GaMeasurementProtocol\Model\GAHit
Class GAHit
Synopsis
class GAHit
extends DataObject
{
- // constants
- const PAGEVIEW = 'pageview';
- const EVENT = 'event';
- const TIMING = 'timing';
- // members
- private static string $table_name = 'IRX_GoogleAnalyticsHit';
- private static string $singular_name = 'GA Hit';
- private static string $plural_name = 'GA Hits';
- private static array $allowedHitTypes = ;
- private $trackingID;
- private $clientID;
- private $hitType;
- private $documentLocationURL;
- private array $parameters = ;
- // methods
- public bool useProductionGAProperty()
- public int getProtocolVersion()
- public void setTrackingID()
- public void setClientID()
- public static string|null generateClientID()
- public void setUserAgent()
- public void setHitType()
- public void setDocumentLocationURL()
- public void setPageviewParameters()
- public void setEventParameters()
- public void setTimingParameters()
- public void setNonInteractionHit()
- public int getCacheBuster()
- public void sendHit()
- public bool checkMinimumParameters()
- public string buildURL()
- public string getEndpoint()
- public string getIPAddress()
- public void addParameters()
Hierarchy
Extends
- SilverStripe\ORM\DataObject
Uses
- SilverStripe\Core\Config\Configurable
Constants
Name | Value |
---|---|
PAGEVIEW | 'pageview' |
EVENT | 'event' |
TIMING | 'timing' |
Members
private
- $allowedHitTypes — array
- $clientID —
- $documentLocationURL —
- $hitType —
- $parameters — array
- $plural_name — string
- $singular_name — string
- $table_name — string
- $trackingID —
Methods
public
- addParameters() — Add additional parameters to the hits i.e For Custom Dimensions / Custom Metric or any parameters not currently covered by this module
- buildURL() — Build out the URL with query string
- checkMinimumParameters() — Check that all required parameters have been provided.
- generateClientID() — Generates a unique ClientID or retrieve it from the _ga cookie
- getCacheBuster() — Random integer appended to end of request so that requests is not cached
- getEndpoint() — Returns Google Measurement Protocol endpoint where hits are sent to
- getIPAddress() — Return the IP of the current request and attaches it to the hit.
- getProtocolVersion() — Returns the protocol version. Will only change if Google introduces backwards incompatible changes in the future
- sendHit() — Send the hit to Google Analytics using Measurement Protocol
- setClientID() — Set the GA Client ID for the hit
- setDocumentLocationURL() — Set the Document Location URL
- setEventParameters() — Sets the parameters for Event hits
- setHitType() — Set the type of hit being sent.
- setNonInteractionHit() — Set the hit as a non-interaction hit
- setPageviewParameters() — Set the parameters for Pageview hits For 'pageview' hits, either &dl or both &dh and &dp have to be specified for the hit to be valid.
- setTimingParameters() — Sets the parameters for timing hits
- setTrackingID() — Set the GA Tracking ID of the property where hits will be sent to
- setUserAgent() — Set the user agent for a hit. Usually required as Google Analytics will often class any hits without a user-agent as spam bot traffic Either reads from the headers or can be manually overriden by a developer
- useProductionGAProperty() — Determines where the GA hit should be sent to: Production or Staging property