diff options
author | Matthieu Aubry <matt@piwik.org> | 2015-12-04 08:36:20 +0300 |
---|---|---|
committer | Matthieu Aubry <matt@piwik.org> | 2015-12-04 08:36:20 +0300 |
commit | 05852332f2a693b0cc313152fcb742fc063aa995 (patch) | |
tree | 13cc3bf7a46ba342d1171221a9dfc76cce0dd049 /core | |
parent | 24839681ebba4d8cd021009b7261f459b91cca87 (diff) | |
parent | ea0ee79d05e7d27df4c360e5a28bcfa2834ab183 (diff) |
Merge pull request #9320 from piwik/website_path
Added support to specify a path in a website URL and Piwik will consider the path during tracking
Diffstat (limited to 'core')
-rw-r--r-- | core/Tracker/TrackerCodeGenerator.php | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/core/Tracker/TrackerCodeGenerator.php b/core/Tracker/TrackerCodeGenerator.php index fbf4b4c2be..c985db88e7 100644 --- a/core/Tracker/TrackerCodeGenerator.php +++ b/core/Tracker/TrackerCodeGenerator.php @@ -172,13 +172,23 @@ class TrackerCodeGenerator } // We need to parse_url to isolate hosts $websiteHosts = array(); + $firstHost = null; foreach ($websiteUrls as $site_url) { $referrerParsed = parse_url($site_url); - $websiteHosts[] = $referrerParsed['host']; + + if (!isset($firstHost)) { + $firstHost = $referrerParsed['host']; + } + + $url = $referrerParsed['host']; + if (!empty($referrerParsed['path'])) { + $url .= $referrerParsed['path']; + } + $websiteHosts[] = $url; } $options = ''; - if ($mergeSubdomains && !empty($websiteHosts)) { - $options .= ' _paq.push(["setCookieDomain", "*.' . $websiteHosts[0] . '"]);' . "\n"; + if ($mergeSubdomains && !empty($firstHost)) { + $options .= ' _paq.push(["setCookieDomain", "*.' . $firstHost . '"]);' . "\n"; } if ($mergeAliasUrls && !empty($websiteHosts)) { $urls = '["*.' . implode('","*.', $websiteHosts) . '"]'; |