updated plugin WP-Matomo Integration
version 1.0.28
This commit is contained in:
@ -82,7 +82,7 @@ class TrackingCode {
|
||||
$code = str_replace ( "_paq.push(['trackPageView']);", "_paq.push(['setDownloadClasses', '" . ($settings->getGlobalOption ( 'set_download_classes' )) . "']);\n_paq.push(['trackPageView']);", $code );
|
||||
if ($settings->getGlobalOption ( 'set_link_classes' ))
|
||||
$code = str_replace ( "_paq.push(['trackPageView']);", "_paq.push(['setLinkClasses', '" . ($settings->getGlobalOption ( 'set_link_classes' )) . "']);\n_paq.push(['trackPageView']);", $code );
|
||||
if ($settings->getGlobalOption ( 'limit_cookies' ))
|
||||
if ($settings->getGlobalOption ( 'limit_cookies' ))
|
||||
$code = str_replace ( "_paq.push(['trackPageView']);", "_paq.push(['setVisitorCookieTimeout', '" . $settings->getGlobalOption ( 'limit_cookies_visitor' ) . "']);\n_paq.push(['setSessionCookieTimeout', '" . $settings->getGlobalOption ( 'limit_cookies_session' ) . "']);\n_paq.push(['setReferralCookieTimeout', '" . $settings->getGlobalOption ( 'limit_cookies_referral' ) . "']);\n_paq.push(['trackPageView']);", $code );
|
||||
if ($settings->getGlobalOption ( 'force_protocol' ) != 'disabled')
|
||||
$code = str_replace ( '"//', '"' . $settings->getGlobalOption ( 'force_protocol' ) . '://', $code );
|
||||
@ -92,6 +92,11 @@ class TrackingCode {
|
||||
$code = str_replace ( "_paq.push(['trackPageView']);", "_paq.push(['trackPageView']);\n_paq.push(['trackVisibleContentImpressions']);", $code );
|
||||
if ((int) $settings->getGlobalOption ( 'track_heartbeat' ) > 0)
|
||||
$code = str_replace ( "_paq.push(['trackPageView']);", "_paq.push(['trackPageView']);\n_paq.push(['enableHeartBeatTimer', ".(int) $settings->getGlobalOption ( 'track_heartbeat' )."]);", $code );
|
||||
if ($settings->getGlobalOption ( 'require_consent' ) == 'consent') {
|
||||
$code = str_replace ( "_paq.push(['trackPageView']);", "_paq.push(['requireConsent']);\n_paq.push(['trackPageView']);", $code );
|
||||
} elseif ($settings->getGlobalOption ( 'require_consent' ) == 'cookieconsent') {
|
||||
$code = str_replace ( "_paq.push(['trackPageView']);", "_paq.push(['requireCookieConsent']);\n_paq.push(['trackPageView']);", $code );
|
||||
}
|
||||
|
||||
$noScript = array ();
|
||||
preg_match ( '/<noscript>(.*)<\/noscript>/', $code, $noScript );
|
||||
@ -118,9 +123,9 @@ class TrackingCode {
|
||||
}
|
||||
|
||||
private function applySearchChanges() {
|
||||
global $wp_query;
|
||||
self::$wpPiwik->log ( 'Apply search tracking changes. Blog ID: ' . get_current_blog_id () . ' Site ID: ' . self::$wpPiwik->getOption ( 'site_id' ) );
|
||||
$objSearch = new \WP_Query ( "s=" . get_search_query () . '&showposts=-1' );
|
||||
$intResultCount = $objSearch->post_count;
|
||||
$intResultCount = $wp_query->found_posts;
|
||||
$this->trackingCode = str_replace ( "_paq.push(['trackPageView']);", "_paq.push(['trackSiteSearch','" . get_search_query () . "', false, " . $intResultCount . "]);\n_paq.push(['trackPageView']);", $this->trackingCode );
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user