diff options
author | Marcin Czołnowski <marcin@czolnowski.net> | 2014-10-03 17:05:52 +0400 |
---|---|---|
committer | Marcin Czołnowski <marcin@czolnowski.net> | 2014-10-03 17:05:52 +0400 |
commit | 20d509aac3fcb97efb8c34f3e0c8594f5f16d28f (patch) | |
tree | 494fe7148316b905ecf775801f1ec83a4eb8db8d /core/Piwik.php | |
parent | 1a7dbc5ff6ab987338fa644f1c4c7a07602c10f6 (diff) |
Extend tracking with all changes.
Diffstat (limited to 'core/Piwik.php')
-rw-r--r-- | core/Piwik.php | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/core/Piwik.php b/core/Piwik.php index 16f50f387f..13124728f9 100644 --- a/core/Piwik.php +++ b/core/Piwik.php @@ -142,6 +142,7 @@ class Piwik // Build optional parameters to be added to text $options = ''; + $optionsBeforeTrackerUrl = ''; if ($groupPageTitlesByDomain) { $options .= ' _paq.push(["setDocumentTitle", document.domain + "/" + document.title]);' . PHP_EOL; } @@ -187,7 +188,9 @@ class Piwik $codeImpl = array( 'idSite' => $idSite, 'piwikUrl' => Common::sanitizeInputValue($piwikUrl), - 'options' => $options + 'options' => $options, + 'optionsBeforeTrackerUrl' => $optionsBeforeTrackerUrl, + 'protocol' => '//' ); $parameters = compact('mergeSubdomains', 'groupPageTitlesByDomain', 'mergeAliasUrls', 'visitorCustomVariables', 'pageCustomVariables', 'customCampaignNameQueryParam', 'customCampaignKeywordParam', @@ -205,6 +208,10 @@ class Piwik * - **piwikUrl**: The tracker URL to use. * - **options**: A string of JavaScript code that customises * the JavaScript tracker. + * - **optionsBeforeTrackerUrl**: A string of Javascript code that customises + * the JavaScript tracker inside of anonymous function before + * adding setTrackerUrl into paq. + * - **protocol**: Piwik url protocol. * * The **httpsPiwikUrl** element can be set if the HTTPS * domain is different from the normal domain. @@ -212,7 +219,7 @@ class Piwik */ self::postEvent('Piwik.getJavascriptCode', array(&$codeImpl, $parameters)); - $setTrackerUrl = 'var u="//{$piwikUrl}/";'; + $setTrackerUrl = 'var u="' . $codeImpl['protocol'] . '{$piwikUrl}/";'; if (!empty($codeImpl['httpsPiwikUrl'])) { $setTrackerUrl = 'var u=((document.location.protocol === "https:") ? "https://{$httpsPiwikUrl}/" : "http://{$piwikUrl}/");'; |