PHP Класс Craft\InstantAnalyticsService

Наследование: extends craft\BaseApplicationComponent
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$cachedAnalytics

Открытые методы

Метод Описание
addCommerceCheckoutStep ( IAnalytics $analytics = null, Commerce_OrderModel $orderModel = null, integer $step = 1, string $option = "" ) Add a checkout step and option to an Analytics object
addCommerceOrderToAnalytics ( IAnalytics $analytics = null, Commerce_OrderModel $orderModel = null ) Add a Craft Commerce OrderModel to an Analytics object
addCommerceProductDetailView ( IAnalytics $analytics = null, $productVariant = null ) Add a product detail view from a Craft Commerce Product or Variant
addCommerceProductImpression ( IAnalytics $analytics = null, $productVariant = null, integer $index, $listName = "" ) Add a product impression from a Craft Commerce Product or Variant
addProductDataFromLineItem ( $analytics = null, $lineItem = null, $index, $listName = "" ) : string Add a Craft Commerce LineItem to an Analytics object
addToCart ( Commerce_OrderModel $orderModel = null, Commerce_LineItemModel $lineItem = null ) Send analytics information for the item added to the cart
analytics ( ) : Analytics getAnalyticsObject() return an analytics object
eventAnalytics ( $eventCategory = "", $eventAction = "", $eventLabel = "", $eventValue ) : Analytics Get an Event analytics object
eventTrackingUrl ( string $url, string $eventCategory = "", string $eventAction = "", string $eventLabel = "", string $eventValue ) : string Get an Event tracking URL
getGlobals ( $title ) : array Get the global variables for our Twig context
getProductDataFromProduct ( $productVariant = null, $index, $listName = "" ) : array Extract product data from a Craft Commerce Product or Variant
orderComplete ( Commerce_OrderModel $orderModel = null ) Send analytics information for the completed order
pageViewAnalytics ( $url = "", $title = "" ) : Analytics Get a PageView analytics object
pageViewTrackingUrl ( string $url, string $title ) : string Get a PageView tracking URL
removeFromCart ( $orderModel = null, $lineItem = null ) Send analytics information for the item removed from the cart
shouldSendAnalytics ( ) : boolean _shouldSendAnalytics determines whether we should be sending Google Analytics data

Приватные методы

Метод Описание
_gaGenUUID ( ) : string _gaGenUUID Generate UUID v4 function - needed to generate a CID when one isn't available
_gaParseCookie ( ) : string _gaParseCookie handles the parsing of the _ga cookie or setting it to a unique identifier
_getAnalyticsObj ( ) : Analytics Get the Google Analytics object, primed with the default values
_getGclid ( ) _getGclid get the gclid and sets the 'gclid' cookie
_pullDataFromField ( $productVariant, $fieldHandle ) : string Extract the value of a field

Описание методов

addCommerceCheckoutStep() публичный Метод

Add a checkout step and option to an Analytics object
public addCommerceCheckoutStep ( IAnalytics $analytics = null, Commerce_OrderModel $orderModel = null, integer $step = 1, string $option = "" )
$analytics IAnalytics the Analytics object
$orderModel Commerce_OrderModel the Product or Variant
$step integer the checkout step
$option string the checkout option

addCommerceOrderToAnalytics() публичный Метод

Add a Craft Commerce OrderModel to an Analytics object
public addCommerceOrderToAnalytics ( IAnalytics $analytics = null, Commerce_OrderModel $orderModel = null )
$analytics IAnalytics the Analytics object
$orderModel Commerce_OrderModel the Product or Variant

addCommerceProductDetailView() публичный Метод

Add a product detail view from a Craft Commerce Product or Variant
public addCommerceProductDetailView ( IAnalytics $analytics = null, $productVariant = null )
$analytics IAnalytics the Analytics object

addCommerceProductImpression() публичный Метод

Add a product impression from a Craft Commerce Product or Variant
public addCommerceProductImpression ( IAnalytics $analytics = null, $productVariant = null, integer $index, $listName = "" )
$analytics IAnalytics the Analytics object
$index integer Where the product appears in the list

addProductDataFromLineItem() публичный Метод

Add a Craft Commerce LineItem to an Analytics object
public addProductDataFromLineItem ( $analytics = null, $lineItem = null, $index, $listName = "" ) : string
Результат string the title of the product

addToCart() публичный Метод

Send analytics information for the item added to the cart
public addToCart ( Commerce_OrderModel $orderModel = null, Commerce_LineItemModel $lineItem = null )
$orderModel Commerce_OrderModel the Product or Variant
$lineItem Commerce_LineItemModel the line item that was added

analytics() публичный Метод

getAnalyticsObject() return an analytics object
public analytics ( ) : Analytics
Результат TheIconic\Tracking\GoogleAnalytics\Analytics object

eventAnalytics() публичный Метод

Get an Event analytics object
public eventAnalytics ( $eventCategory = "", $eventAction = "", $eventLabel = "", $eventValue ) : Analytics
Результат TheIconic\Tracking\GoogleAnalytics\Analytics object

eventTrackingUrl() публичный Метод

Get an Event tracking URL
public eventTrackingUrl ( string $url, string $eventCategory = "", string $eventAction = "", string $eventLabel = "", string $eventValue ) : string
$url string the URL to track
$eventCategory string the event category
$eventAction string the event action
$eventLabel string the event label
$eventValue string the event value
Результат string the tracking URL

getGlobals() публичный Метод

Get the global variables for our Twig context
public getGlobals ( $title ) : array
Результат array with 'instantAnalytics' => Analytics object

getProductDataFromProduct() публичный Метод

Extract product data from a Craft Commerce Product or Variant
public getProductDataFromProduct ( $productVariant = null, $index, $listName = "" ) : array
Результат array the product data

orderComplete() публичный Метод

Send analytics information for the completed order
public orderComplete ( Commerce_OrderModel $orderModel = null )
$orderModel Commerce_OrderModel the Product or Variant

pageViewAnalytics() публичный Метод

Get a PageView analytics object
public pageViewAnalytics ( $url = "", $title = "" ) : Analytics
Результат TheIconic\Tracking\GoogleAnalytics\Analytics object

pageViewTrackingUrl() публичный Метод

Get a PageView tracking URL
public pageViewTrackingUrl ( string $url, string $title ) : string
$url string the URL to track
$title string the page title
Результат string the tracking URL

removeFromCart() публичный Метод

Send analytics information for the item removed from the cart
public removeFromCart ( $orderModel = null, $lineItem = null )

shouldSendAnalytics() публичный Метод

_shouldSendAnalytics determines whether we should be sending Google Analytics data
public shouldSendAnalytics ( ) : boolean
Результат boolean

Описание свойств

$cachedAnalytics защищенное свойство

protected $cachedAnalytics