class Tracker extends AbstractTracker (View source)

Constants

BLOCK_BEFORE_SCRIPT_TAG

BLOCK_BEFORE_SCRIPT

BLOCK_BEFORE_INIT

BLOCK_BEFORE_TRACK

BLOCK_AFTER_TRACK

BLOCK_AFTER_SCRIPT

BLOCK_AFTER_SCRIPT_TAG

Methods

__construct(SiteIdProvider $siteIdProvider, ConfigProvider $configProvider, EventDispatcherInterface $eventDispatcher, EngineInterface $templatingEngine)

No description

null|string
generateCode(SiteId $siteId = null)

No description

string|null
buildCode(SiteId $siteId)

Generates code for a specific site config

addCodePart(string $code, string $block = null, bool $prepend = false, SiteId $siteId = null)

No description

getCodeCollector()

Lazy initialize the code collector

buildCodeCollector()

Builds the code collector which allows to add additional content to specific blocks.

getDefaultPath()

No description

setDefaultPath(string $defaultPath = null)

No description

setLogger(LoggerInterface $logger)

TODO Pimcore 6 set logger as constructor dependency

string
generateCodeForSiteConfig(Config $siteConfig, SiteId $siteId = null)

This method exists for BC with the existing Pimcore\Google\Analytics implementation which supports to pass a config object without a Site ID. Should be removed at a later point.

Details

__construct(SiteIdProvider $siteIdProvider, ConfigProvider $configProvider, EventDispatcherInterface $eventDispatcher, EngineInterface $templatingEngine)

Parameters

SiteIdProvider $siteIdProvider
ConfigProvider $configProvider
EventDispatcherInterface $eventDispatcher
EngineInterface $templatingEngine

null|string generateCode(SiteId $siteId = null)

Parameters

SiteId $siteId

Return Value

null|string Null if no tracking is configured

protected string|null buildCode(SiteId $siteId)

Generates code for a specific site config

Parameters

SiteId $siteId

Return Value

string|null

addCodePart(string $code, string $block = null, bool $prepend = false, SiteId $siteId = null)

Parameters

string $code The code to add
string $block The block where to add the code (will use default block if none given)
bool $prepend Whether to prepend the code to the code block
SiteId $siteId Restrict code to a specific site

protected CodeCollector getCodeCollector()

Lazy initialize the code collector

Return Value

CodeCollector

protected CodeCollector buildCodeCollector()

Builds the code collector which allows to add additional content to specific blocks.

Return Value

CodeCollector

getDefaultPath()

setDefaultPath(string $defaultPath = null)

Parameters

string $defaultPath

setLogger(LoggerInterface $logger)

TODO Pimcore 6 set logger as constructor dependency

Parameters

LoggerInterface $logger

string generateCodeForSiteConfig(Config $siteConfig, SiteId $siteId = null)

This method exists for BC with the existing Pimcore\Google\Analytics implementation which supports to pass a config object without a Site ID. Should be removed at a later point.

Parameters

Config $siteConfig
SiteId $siteId

Return Value

string