PHP Interface Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface

Mostrar archivo Open project: ipunkt/laravel-analytics

Public Methods

Method Description
cspNonce ( ) : string | null returns the current Content Security Policy nonce
disableAutoTracking ( ) : Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface disable auto tracking
disableDisplayFeatures ( ) : Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface disable display features
disableEcommerceTracking ( ) : Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface disable ecommerce tracking
disableScriptBlock ( ) do not render script block
ecommerceAddItem ( string $id, string $name, null | string $sku = null, null | string $category = null, null | float $price = null, null | integer $quantity = null ) : Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface ecommerce tracking - add item
ecommerceAddTransaction ( string $id, null | string $affiliation = null, null | float $revenue = null, null | float $shipping = null, null | float $tax = null ) : Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface ecommerce tracking - add transaction
enableAutoTracking ( ) : Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface enable auto tracking
enableDisplayFeatures ( ) : Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface enable display features
enableEcommerceTracking ( ) : Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface enable ecommerce tracking
enableScriptBlock ( ) render script block
nonInteraction ( boolean | null $value = null ) : boolean | Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface sets or gets nonInteraction
render ( ) : string returns the javascript code for embedding the analytics stuff
setCampaign ( Campaign $campaign ) : Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface sets a campaign
setCustom ( string | array $dimension, null | string $value = null ) : Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface sets custom dimensions
setUserId ( string $userId ) : Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface sets an user id for user tracking
trackCustom ( string $customCode ) : void track any custom code
trackEvent ( string $category, string $action, null | string $label, null | integer $value ) : void track an event
trackMeasurementUrl ( string $metricName, mixed $metricValue, Event $event, Campaign $campaign, string | null $clientId = null, array $params = [] ) : string assembles an url for tracking measurement without javascript
trackPage ( null | string $page, null | string $title, null | string $hittype ) : void track an page view
unsetCampaign ( ) : Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface unsets a possible given campaign
unsetUserId ( ) : Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface unsets a possible given user id
withCSP ( ) : Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface enables Content Security Polity and sets nonce
withoutCSP ( ) : Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface disables Content Security Polity

Method Details

cspNonce() public method

returns the current Content Security Policy nonce
public cspNonce ( ) : string | null
return string | null

disableAutoTracking() public method

disable auto tracking
public disableAutoTracking ( ) : Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface
return Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface

disableDisplayFeatures() public method

disable display features
public disableDisplayFeatures ( ) : Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface
return Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface

disableEcommerceTracking() public method

disable ecommerce tracking
public disableEcommerceTracking ( ) : Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface
return Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface

disableScriptBlock() public method

do not render script block
public disableScriptBlock ( )

ecommerceAddItem() public method

ecommerce tracking - add item
public ecommerceAddItem ( string $id, string $name, null | string $sku = null, null | string $category = null, null | float $price = null, null | integer $quantity = null ) : Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface
$id string
$name string
$sku null | string
$category null | string
$price null | float
$quantity null | integer
return Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface

ecommerceAddTransaction() public method

ecommerce tracking - add transaction
public ecommerceAddTransaction ( string $id, null | string $affiliation = null, null | float $revenue = null, null | float $shipping = null, null | float $tax = null ) : Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface
$id string
$affiliation null | string
$revenue null | float
$shipping null | float
$tax null | float
return Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface

enableAutoTracking() public method

enable auto tracking
public enableAutoTracking ( ) : Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface
return Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface

enableDisplayFeatures() public method

enable display features
public enableDisplayFeatures ( ) : Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface
return Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface

enableEcommerceTracking() public method

enable ecommerce tracking
public enableEcommerceTracking ( ) : Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface
return Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface

enableScriptBlock() public method

render script block
public enableScriptBlock ( )

nonInteraction() public method

setting: $this->nonInteraction(true)->render(); getting: if ($this->nonInteraction()) echo 'non-interaction set';
public nonInteraction ( boolean | null $value = null ) : boolean | Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface
$value boolean | null
return boolean | Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface

render() public method

returns the javascript code for embedding the analytics stuff
public render ( ) : string
return string

setCampaign() public method

sets a campaign
public setCampaign ( Campaign $campaign ) : Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface
$campaign Ipunkt\LaravelAnalytics\Data\Campaign
return Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface

setCustom() public method

sets custom dimensions
public setCustom ( string | array $dimension, null | string $value = null ) : Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface
$dimension string | array
$value null | string
return Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface

setUserId() public method

sets an user id for user tracking
See also: https://developers.google.com/analytics/devguides/collection/analyticsjs/cookies-user-id
public setUserId ( string $userId ) : Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface
$userId string
return Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface

trackCustom() public method

track any custom code
public trackCustom ( string $customCode ) : void
$customCode string
return void

trackEvent() public method

track an event
public trackEvent ( string $category, string $action, null | string $label, null | integer $value ) : void
$category string
$action string
$label null | string
$value null | integer
return void

trackMeasurementUrl() public method

e.g. for tracking email open events within a newsletter
public trackMeasurementUrl ( string $metricName, mixed $metricValue, Event $event, Campaign $campaign, string | null $clientId = null, array $params = [] ) : string
$metricName string
$metricValue mixed
$event Ipunkt\LaravelAnalytics\Data\Event
$campaign Ipunkt\LaravelAnalytics\Data\Campaign
$clientId string | null
$params array
return string

trackPage() public method

track an page view
public trackPage ( null | string $page, null | string $title, null | string $hittype ) : void
$page null | string
$title null | string
$hittype null | string
return void

unsetCampaign() public method

unsets a possible given campaign
public unsetCampaign ( ) : Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface
return Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface

unsetUserId() public method

unsets a possible given user id
public unsetUserId ( ) : Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface
return Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface

withCSP() public method

enables Content Security Polity and sets nonce
public withCSP ( ) : Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface
return Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface

withoutCSP() public method

disables Content Security Polity
public withoutCSP ( ) : Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface
return Ipunkt\LaravelAnalytics\Contracts\AnalyticsProviderInterface