Piwik\
This class provides detection functions for specific content on a site.
Note: Calling the detect() method will create a HTTP request to the site to retrieve data, only the main site URL will be checked
Usage:
$contentDetector = new SiteContentDetector(); $contentDetector->detectContent([SiteContentDetector::GA3]); if ($contentDetector->ga3) { // site is using GA3 }
This class defines the following properties:
$consentManagerId
$consentManagerName
$consentManagerUrl
$isConnected
$ga3
$ga4
$gtm
$cms
$cloudflare
$jsFramework
$consentManagerId
$consentManagerName
$consentManagerUrl
$isConnected
$ga3
$ga4
$gtm
$cms
$cloudflare
$jsFramework
The class defines the following methods:
__construct()
detectContent()
— This will query the site and populate the class properties with the details of the detected contentgetConsentManagerDefinitions()
— Return an array of consent manager definitions which can be used to detect their presence on the site and show the associated guide links__construct()
$cache
(Matomo\Cache\Lazy
|null
) —detectContent()
This will query the site and populate the class properties with the details of the detected content
$detectContent
(array
) —
Array of content type for which to check, defaults to all, limiting this list will speed up the detection check$idSite
(int
|null
) —
Override the site ID, will use the site from the current request if null$siteResponse
(array
|null
) —
String containing the site data to search, if blank then data will be retrieved from the current request site via an http request$timeOut
(int
) —
How long to wait for the site to response, defaults to 5 secondsvoid
value.getConsentManagerDefinitions()
Return an array of consent manager definitions which can be used to detect their presence on the site and show the associated guide links
Note: This list is also used to display the known / supported consent managers on the "Ask for Consent" page For adding a new consent manager to this page, it needs to be added here. If a consent manager can't be detected automatically, simply leave the detections empty.
array
value.