diff options
author | Stefan Giehl <stefan@matomo.org> | 2021-03-11 20:06:23 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-11 20:06:23 +0300 |
commit | 96fcda9f807e157409173a6135a895e358f52c95 (patch) | |
tree | 1159bb4b264315401e6354d3f69e117c086b1100 | |
parent | c334b3d84e630af9c6f30a81aa5810057ae08bac (diff) |
Use https for urls in visitor details if host is defined with https in site (#17151)
* Use https for urls in visitor details if host is defined with https in site
* Use strpos/parse_url instead of preg_match
* apply review feedback
* also replace protocol in url metadata in page urls reports
* apply review feedback
Co-authored-by: diosmosis <diosmosis@users.noreply.github.com>
10 files changed, 652 insertions, 7 deletions
diff --git a/core/Tracker/PageUrl.php b/core/Tracker/PageUrl.php index a28d66f579..b20c4999a7 100644 --- a/core/Tracker/PageUrl.php +++ b/core/Tracker/PageUrl.php @@ -9,9 +9,13 @@ namespace Piwik\Tracker; +use Piwik\Cache; +use Piwik\CacheId; +use Piwik\Tracker\Cache as TrackerCache; use Piwik\Common; use Piwik\Config; use Piwik\Piwik; +use Piwik\Plugins\SitesManager\API as APISitesManager; use Piwik\UrlHelper; class PageUrl @@ -80,7 +84,7 @@ class PageUrl $campaignTrackingParameters[1] // campaign keyword parameters ); - $website = Cache::getCacheWebsiteAttributes($idSite); + $website = TrackerCache::getCacheWebsiteAttributes($idSite); $excludedParameters = self::getExcludedParametersFromWebsite($website); $parametersToExclude = array_merge($excludedParameters, @@ -127,7 +131,7 @@ class PageUrl */ public static function shouldRemoveURLFragmentFor($idSite) { - $websiteAttributes = Cache::getCacheWebsiteAttributes($idSite); + $websiteAttributes = TrackerCache::getCacheWebsiteAttributes($idSite); return empty($websiteAttributes['keep_url_fragment']); } @@ -336,6 +340,44 @@ class PageUrl } /** + * Returns if the given host is also configured as https in page urls of given site + * + * @param $idSite + * @param $host + * @return false|mixed + * @throws \Exception + */ + public static function shouldUseHttpsHost($idSite, $host) + { + $cache = Cache::getTransientCache(); + + $cacheKeySiteUrls = CacheId::siteAware('siteurls', [$idSite]); + $cacheKeyHttpsForHost = CacheId::siteAware(sprintf('shouldusehttps-%s', $host), [$idSite]); + + $siteUrlCache = $cache->fetch($cacheKeySiteUrls); + + if (empty($siteUrlCache)) { + $siteUrlCache = APISitesManager::getInstance()->getSiteUrlsFromId($idSite); + $cache->save($cacheKeySiteUrls, $siteUrlCache); + } + + if (!$cache->contains($cacheKeyHttpsForHost)) { + $hostSiteCache = false; + + foreach ($siteUrlCache as $siteUrl) { + if (strpos(Common::mb_strtolower($siteUrl), Common::mb_strtolower('https://' . $host)) === 0) { + $hostSiteCache = true; + break; + } + } + + $cache->save($cacheKeyHttpsForHost, $hostSiteCache); + } + + return $cache->fetch($cacheKeyHttpsForHost); + } + + /** * Extract the prefix from a URL. * Return the prefix ID and the rest. * diff --git a/plugins/Actions/DataTable/Filter/Actions.php b/plugins/Actions/DataTable/Filter/Actions.php index e9f7d8fca8..fff3491d1c 100644 --- a/plugins/Actions/DataTable/Filter/Actions.php +++ b/plugins/Actions/DataTable/Filter/Actions.php @@ -15,6 +15,7 @@ use Piwik\DataTable\Row; use Piwik\DataTable; use Piwik\Plugins\Actions\ArchivingHelper; use Piwik\Tracker\Action; +use Piwik\Tracker\PageUrl; class Actions extends BaseFilter { @@ -66,6 +67,14 @@ class Actions extends BaseFilter $label = $row->getColumn('label'); if ($url) { $row->setMetadata('segmentValue', urlencode($url)); + + if ($site && strpos($url, 'http://') === 0) { + $host = parse_url($url, PHP_URL_HOST); + + if ($host && PageUrl::shouldUseHttpsHost($site->getId(), $host)) { + $row->setMetadata('url', 'https://' . Common::mb_substr($url, 7 /* = strlen('http://') */)); + } + } } else if ($folderUrlStart) { $row->setMetadata('segment', 'pageUrl=^' . urlencode(urlencode($folderUrlStart))); } else if ($pageTitlePath) { diff --git a/plugins/Actions/VisitorDetails.php b/plugins/Actions/VisitorDetails.php index 4aed002314..2d3e4dde6d 100644 --- a/plugins/Actions/VisitorDetails.php +++ b/plugins/Actions/VisitorDetails.php @@ -8,6 +8,7 @@ */ namespace Piwik\Plugins\Actions; +use Piwik\Cache; use Piwik\Common; use Piwik\Config; use Piwik\Date; @@ -16,6 +17,7 @@ use Piwik\Metrics\Formatter; use Piwik\Piwik; use Piwik\Plugin; use Piwik\Plugins\Live\VisitorDetailsAbstract; +use Piwik\Plugins\SitesManager\API as APISitesManager; use Piwik\Site; use Piwik\Tracker\Action; use Piwik\Tracker\PageUrl; @@ -160,6 +162,14 @@ class VisitorDetails extends VisitorDetailsAbstract unset($action['url_prefix']); } + if (array_key_exists('url', $action) && strpos($action['url'], 'http://') === 0) { + $host = parse_url($action['url'], PHP_URL_HOST); + + if ($host && PageUrl::shouldUseHttpsHost($visitorDetails['idSite'], $host)) { + $action['url'] = 'https://' . Common::mb_substr($action['url'], 7 /* = strlen('http://') */); + } + } + switch ($action['type']) { case 'goal': $action['icon'] = 'plugins/Morpheus/images/goal.png'; diff --git a/plugins/Live/tests/System/ApiTest.php b/plugins/Live/tests/System/ApiTest.php index 1df94ce55b..9236600a75 100644 --- a/plugins/Live/tests/System/ApiTest.php +++ b/plugins/Live/tests/System/ApiTest.php @@ -8,6 +8,7 @@ namespace Piwik\Plugins\Live\tests\System; +use Piwik\Cache; use Piwik\Config; use Piwik\Plugins\API\API; use Piwik\Plugins\Live\SystemSettings; @@ -163,6 +164,20 @@ class ApiTest extends SystemTestCase ]); } + public function testApiWithHttpsHost() + { + \Piwik\Plugins\SitesManager\API::getInstance()->updateSite(1, 'Piwik test', ['http://piwik.net', 'https://example.org', 'http://example.org']); + Cache::getTransientCache()->flushAll(); + + $this->runApiTests('Live.getLastVisitsDetails', [ + 'idSite' => 1, + 'date' => self::$fixture->dateTime, + 'periods' => ['day'], + 'testSuffix' => 'httpshost', + ]); + } + + /** * @dataProvider getApiForTestingDisabledFeatures */ diff --git a/plugins/Live/tests/System/expected/test_httpshost__Live.getLastVisitsDetails_day.xml b/plugins/Live/tests/System/expected/test_httpshost__Live.getLastVisitsDetails_day.xml new file mode 100644 index 0000000000..c7aed20718 --- /dev/null +++ b/plugins/Live/tests/System/expected/test_httpshost__Live.getLastVisitsDetails_day.xml @@ -0,0 +1,568 @@ +<?xml version="1.0" encoding="utf-8" ?> +<result> + <row> + <idSite>1</idSite> + <idVisit>4</idVisit> + <visitIp>156.5.3.2</visitIp> + + <fingerprint>5041e282fc23fef1</fingerprint> + <actionDetails> + <row> + <type>action</type> + <url>https://example.org/my/dir/page0</url> + <pageTitle>incredible title 0</pageTitle> + <pageIdAction>9</pageIdAction> + + + <pageId>14</pageId> + <bandwidth /> + <pageviewPosition>1</pageviewPosition> + <title>incredible title 0</title> + <subtitle>https://example.org/my/dir/page0</subtitle> + <icon /> + <iconSVG>plugins/Morpheus/images/action.svg</iconSVG> + + <bandwidth_pretty>0 M</bandwidth_pretty> + </row> + </actionDetails> + <goalConversions>0</goalConversions> + <siteCurrency>USD</siteCurrency> + <siteCurrencySymbol>$</siteCurrencySymbol> + + + + + <siteName>Piwik test</siteName> + + + + + + + <userId /> + <visitorType>returning</visitorType> + <visitorTypeIcon>plugins/Live/images/returningVisitor.png</visitorTypeIcon> + <visitConverted>0</visitConverted> + <visitConvertedIcon /> + <visitCount>3</visitCount> + <visitEcommerceStatus>none</visitEcommerceStatus> + <visitEcommerceStatusIcon /> + <daysSinceFirstVisit>0</daysSinceFirstVisit> + <secondsSinceFirstVisit>720</secondsSinceFirstVisit> + <daysSinceLastEcommerceOrder>0</daysSinceLastEcommerceOrder> + <secondsSinceLastEcommerceOrder /> + <visitDuration>0</visitDuration> + <visitDurationPretty>0s</visitDurationPretty> + <searches>0</searches> + <actions>1</actions> + <interactions>1</interactions> + <referrerType>direct</referrerType> + <referrerTypeName>Direct Entry</referrerTypeName> + <referrerName /> + <referrerKeyword /> + <referrerKeywordPosition /> + <referrerUrl /> + <referrerSearchEngineUrl /> + <referrerSearchEngineIcon /> + <referrerSocialNetworkUrl /> + <referrerSocialNetworkIcon /> + <languageCode /> + <language>Unknown</language> + <deviceType>Unknown</deviceType> + <deviceTypeIcon>plugins/Morpheus/icons/dist/devices/unknown.png</deviceTypeIcon> + <deviceBrand>Unknown</deviceBrand> + <deviceModel>Unknown</deviceModel> + <operatingSystem>Unknown</operatingSystem> + <operatingSystemName>Unknown</operatingSystemName> + <operatingSystemIcon>plugins/Morpheus/icons/dist/os/UNK.png</operatingSystemIcon> + <operatingSystemCode>UNK</operatingSystemCode> + <operatingSystemVersion>UNK</operatingSystemVersion> + <browserFamily /> + <browserFamilyDescription>Unknown</browserFamilyDescription> + <browser>Unknown</browser> + <browserName>Unknown</browserName> + <browserIcon>plugins/Morpheus/icons/dist/browsers/UNK.png</browserIcon> + <browserCode>UNK</browserCode> + <browserVersion /> + <totalEcommerceRevenue>0</totalEcommerceRevenue> + <totalEcommerceConversions>0</totalEcommerceConversions> + <totalEcommerceItems>0</totalEcommerceItems> + <totalAbandonedCartsRevenue>0</totalAbandonedCartsRevenue> + <totalAbandonedCarts>0</totalAbandonedCarts> + <totalAbandonedCartsItems>0</totalAbandonedCartsItems> + <events>0</events> + <continent>Unknown</continent> + <continentCode>unk</continentCode> + <country>Unknown</country> + <countryCode>xx</countryCode> + <countryFlag>plugins/Morpheus/icons/dist/flags/xx.png</countryFlag> + <region /> + <regionCode /> + <city /> + <location>Unknown</location> + <latitude /> + <longitude /> + <visitLocalTime>12:34:06</visitLocalTime> + <visitLocalHour>12</visitLocalHour> + <daysSinceLastVisit>0</daysSinceLastVisit> + <secondsSinceLastVisit>360</secondsSinceLastVisit> + <resolution>1024x768</resolution> + <plugins>cookie, flash, java</plugins> + <pluginsIcons> + <row> + <pluginIcon>plugins/Morpheus/icons/dist/plugins/cookie.png</pluginIcon> + <pluginName>cookie</pluginName> + </row> + <row> + <pluginIcon>plugins/Morpheus/icons/dist/plugins/flash.png</pluginIcon> + <pluginName>flash</pluginName> + </row> + <row> + <pluginIcon>plugins/Morpheus/icons/dist/plugins/java.png</pluginIcon> + <pluginName>java</pluginName> + </row> + </pluginsIcons> + <customVariables> + </customVariables> + </row> + <row> + <idSite>1</idSite> + <idVisit>3</idVisit> + <visitIp>156.5.3.2</visitIp> + + <fingerprint>5041e282fc23fef1</fingerprint> + <actionDetails> + <row> + <type>action</type> + <url>https://example.org/my/dir/page-1</url> + <pageTitle>incredible title -1</pageTitle> + <pageIdAction>7</pageIdAction> + + + <pageId>13</pageId> + <bandwidth /> + <pageviewPosition>1</pageviewPosition> + <title>incredible title -1</title> + <subtitle>https://example.org/my/dir/page-1</subtitle> + <icon /> + <iconSVG>plugins/Morpheus/images/action.svg</iconSVG> + + <bandwidth_pretty>0 M</bandwidth_pretty> + </row> + </actionDetails> + <goalConversions>0</goalConversions> + <siteCurrency>USD</siteCurrency> + <siteCurrencySymbol>$</siteCurrencySymbol> + + + + + <siteName>Piwik test</siteName> + + + + + + + <userId /> + <visitorType>returning</visitorType> + <visitorTypeIcon>plugins/Live/images/returningVisitor.png</visitorTypeIcon> + <visitConverted>0</visitConverted> + <visitConvertedIcon /> + <visitCount>2</visitCount> + <visitEcommerceStatus>none</visitEcommerceStatus> + <visitEcommerceStatusIcon /> + <daysSinceFirstVisit>0</daysSinceFirstVisit> + <secondsSinceFirstVisit>360</secondsSinceFirstVisit> + <daysSinceLastEcommerceOrder>0</daysSinceLastEcommerceOrder> + <secondsSinceLastEcommerceOrder /> + <visitDuration>0</visitDuration> + <visitDurationPretty>0s</visitDurationPretty> + <searches>0</searches> + <actions>1</actions> + <interactions>1</interactions> + <referrerType>direct</referrerType> + <referrerTypeName>Direct Entry</referrerTypeName> + <referrerName /> + <referrerKeyword /> + <referrerKeywordPosition /> + <referrerUrl /> + <referrerSearchEngineUrl /> + <referrerSearchEngineIcon /> + <referrerSocialNetworkUrl /> + <referrerSocialNetworkIcon /> + <languageCode /> + <language>Unknown</language> + <deviceType>Unknown</deviceType> + <deviceTypeIcon>plugins/Morpheus/icons/dist/devices/unknown.png</deviceTypeIcon> + <deviceBrand>Unknown</deviceBrand> + <deviceModel>Unknown</deviceModel> + <operatingSystem>Unknown</operatingSystem> + <operatingSystemName>Unknown</operatingSystemName> + <operatingSystemIcon>plugins/Morpheus/icons/dist/os/UNK.png</operatingSystemIcon> + <operatingSystemCode>UNK</operatingSystemCode> + <operatingSystemVersion>UNK</operatingSystemVersion> + <browserFamily /> + <browserFamilyDescription>Unknown</browserFamilyDescription> + <browser>Unknown</browser> + <browserName>Unknown</browserName> + <browserIcon>plugins/Morpheus/icons/dist/browsers/UNK.png</browserIcon> + <browserCode>UNK</browserCode> + <browserVersion /> + <totalEcommerceRevenue>0</totalEcommerceRevenue> + <totalEcommerceConversions>0</totalEcommerceConversions> + <totalEcommerceItems>0</totalEcommerceItems> + <totalAbandonedCartsRevenue>0</totalAbandonedCartsRevenue> + <totalAbandonedCarts>0</totalAbandonedCarts> + <totalAbandonedCartsItems>0</totalAbandonedCartsItems> + <events>0</events> + <continent>Unknown</continent> + <continentCode>unk</continentCode> + <country>Unknown</country> + <countryCode>xx</countryCode> + <countryFlag>plugins/Morpheus/icons/dist/flags/xx.png</countryFlag> + <region /> + <regionCode /> + <city /> + <location>Unknown</location> + <latitude /> + <longitude /> + <visitLocalTime>12:34:06</visitLocalTime> + <visitLocalHour>12</visitLocalHour> + <daysSinceLastVisit>0</daysSinceLastVisit> + <secondsSinceLastVisit>360</secondsSinceLastVisit> + <resolution>1024x768</resolution> + <plugins>cookie, flash, java</plugins> + <pluginsIcons> + <row> + <pluginIcon>plugins/Morpheus/icons/dist/plugins/cookie.png</pluginIcon> + <pluginName>cookie</pluginName> + </row> + <row> + <pluginIcon>plugins/Morpheus/icons/dist/plugins/flash.png</pluginIcon> + <pluginName>flash</pluginName> + </row> + <row> + <pluginIcon>plugins/Morpheus/icons/dist/plugins/java.png</pluginIcon> + <pluginName>java</pluginName> + </row> + </pluginsIcons> + <customVariables> + </customVariables> + </row> + <row> + <idSite>1</idSite> + <idVisit>2</idVisit> + <visitIp>156.5.3.2</visitIp> + + <fingerprint>e16cf2bbaeea2c88</fingerprint> + <actionDetails> + <row> + <type>action</type> + <url>https://example.org/my/dir/page-2</url> + <pageTitle>incredible title -2</pageTitle> + <pageIdAction>4</pageIdAction> + + + <pageId>2</pageId> + <bandwidth /> + <timeSpent>0</timeSpent> + <timeSpentPretty>0s</timeSpentPretty> + <pageviewPosition>1</pageviewPosition> + <title>incredible title -2</title> + <subtitle>https://example.org/my/dir/page-2</subtitle> + <icon /> + <iconSVG>plugins/Morpheus/images/action.svg</iconSVG> + + <bandwidth_pretty>0 M</bandwidth_pretty> + </row> + <row> + <type>action</type> + <url>https://example.org/my/dir/page-2</url> + <pageTitle>incredible title 1</pageTitle> + <pageIdAction>4</pageIdAction> + + + <pageId>3</pageId> + <bandwidth /> + <timeSpent>0</timeSpent> + <timeSpentPretty>0s</timeSpentPretty> + <pageviewPosition>2</pageviewPosition> + <title>incredible title 1</title> + <subtitle>https://example.org/my/dir/page-2</subtitle> + <icon /> + <iconSVG>plugins/Morpheus/images/action.svg</iconSVG> + + <bandwidth_pretty>0 M</bandwidth_pretty> + </row> + <row> + <type>action</type> + <url>https://example.org/my/dir/page-2</url> + <pageTitle>incredible title 1</pageTitle> + <pageIdAction>4</pageIdAction> + + + <pageId>4</pageId> + <bandwidth /> + <timeSpent>0</timeSpent> + <timeSpentPretty>0s</timeSpentPretty> + <pageviewPosition>3</pageviewPosition> + <title>incredible title 1</title> + <subtitle>https://example.org/my/dir/page-2</subtitle> + <icon /> + <iconSVG>plugins/Morpheus/images/action.svg</iconSVG> + + <bandwidth_pretty>0 M</bandwidth_pretty> + </row> + <row> + <type>action</type> + <url>https://example.org/my/dir/page-2</url> + <pageTitle>incredible title 1</pageTitle> + <pageIdAction>4</pageIdAction> + + + <pageId>5</pageId> + <bandwidth /> + <timeSpent>0</timeSpent> + <timeSpentPretty>0s</timeSpentPretty> + <pageviewPosition>4</pageviewPosition> + <title>incredible title 1</title> + <subtitle>https://example.org/my/dir/page-2</subtitle> + <icon /> + <iconSVG>plugins/Morpheus/images/action.svg</iconSVG> + + <bandwidth_pretty>0 M</bandwidth_pretty> + </row> + <row> + <type>action</type> + <url>https://example.org/my/dir/page-2</url> + <pageTitle>incredible title 1</pageTitle> + <pageIdAction>4</pageIdAction> + + + <pageId>6</pageId> + <bandwidth /> + <timeSpent>0</timeSpent> + <timeSpentPretty>0s</timeSpentPretty> + <pageviewPosition>5</pageviewPosition> + <title>incredible title 1</title> + <subtitle>https://example.org/my/dir/page-2</subtitle> + <icon /> + <iconSVG>plugins/Morpheus/images/action.svg</iconSVG> + + <bandwidth_pretty>0 M</bandwidth_pretty> + </row> + <row> + <type>action</type> + <url>https://example.org/my/dir/page-2</url> + <pageTitle>incredible title 1</pageTitle> + <pageIdAction>4</pageIdAction> + + + <pageId>7</pageId> + <bandwidth /> + <timeSpent>0</timeSpent> + <timeSpentPretty>0s</timeSpentPretty> + <pageviewPosition>6</pageviewPosition> + <title>incredible title 1</title> + <subtitle>https://example.org/my/dir/page-2</subtitle> + <icon /> + <iconSVG>plugins/Morpheus/images/action.svg</iconSVG> + + <bandwidth_pretty>0 M</bandwidth_pretty> + </row> + <row> + <type>action</type> + <url>https://example.org/my/dir/page-2</url> + <pageTitle>incredible title 1</pageTitle> + <pageIdAction>4</pageIdAction> + + + <pageId>8</pageId> + <bandwidth /> + <timeSpent>0</timeSpent> + <timeSpentPretty>0s</timeSpentPretty> + <pageviewPosition>7</pageviewPosition> + <title>incredible title 1</title> + <subtitle>https://example.org/my/dir/page-2</subtitle> + <icon /> + <iconSVG>plugins/Morpheus/images/action.svg</iconSVG> + + <bandwidth_pretty>0 M</bandwidth_pretty> + </row> + <row> + <type>action</type> + <url>https://example.org/my/dir/page-2</url> + <pageTitle>incredible title 1</pageTitle> + <pageIdAction>4</pageIdAction> + + + <pageId>9</pageId> + <bandwidth /> + <timeSpent>0</timeSpent> + <timeSpentPretty>0s</timeSpentPretty> + <pageviewPosition>8</pageviewPosition> + <title>incredible title 1</title> + <subtitle>https://example.org/my/dir/page-2</subtitle> + <icon /> + <iconSVG>plugins/Morpheus/images/action.svg</iconSVG> + + <bandwidth_pretty>0 M</bandwidth_pretty> + </row> + <row> + <type>action</type> + <url>https://example.org/my/dir/page-2</url> + <pageTitle>incredible title 1</pageTitle> + <pageIdAction>4</pageIdAction> + + + <pageId>10</pageId> + <bandwidth /> + <timeSpent>0</timeSpent> + <timeSpentPretty>0s</timeSpentPretty> + <pageviewPosition>9</pageviewPosition> + <title>incredible title 1</title> + <subtitle>https://example.org/my/dir/page-2</subtitle> + <icon /> + <iconSVG>plugins/Morpheus/images/action.svg</iconSVG> + + <bandwidth_pretty>0 M</bandwidth_pretty> + </row> + <row> + <type>action</type> + <url>https://example.org/my/dir/page-2</url> + <pageTitle>incredible title 1</pageTitle> + <pageIdAction>4</pageIdAction> + + + <pageId>11</pageId> + <bandwidth /> + <timeSpent>0</timeSpent> + <timeSpentPretty>0s</timeSpentPretty> + <pageviewPosition>10</pageviewPosition> + <title>incredible title 1</title> + <subtitle>https://example.org/my/dir/page-2</subtitle> + <icon /> + <iconSVG>plugins/Morpheus/images/action.svg</iconSVG> + + <bandwidth_pretty>0 M</bandwidth_pretty> + </row> + <row> + <type>action</type> + <url>https://example.org/my/dir/page-2</url> + <pageTitle>incredible title 1</pageTitle> + <pageIdAction>4</pageIdAction> + + + <pageId>12</pageId> + <bandwidth /> + <pageviewPosition>11</pageviewPosition> + <title>incredible title 1</title> + <subtitle>https://example.org/my/dir/page-2</subtitle> + <icon /> + <iconSVG>plugins/Morpheus/images/action.svg</iconSVG> + + <bandwidth_pretty>0 M</bandwidth_pretty> + </row> + </actionDetails> + <goalConversions>0</goalConversions> + <siteCurrency>USD</siteCurrency> + <siteCurrencySymbol>$</siteCurrencySymbol> + + + + + <siteName>Piwik test</siteName> + + + + + + + <userId /> + <visitorType>new</visitorType> + <visitorTypeIcon /> + <visitConverted>0</visitConverted> + <visitConvertedIcon /> + <visitCount>1</visitCount> + <visitEcommerceStatus>none</visitEcommerceStatus> + <visitEcommerceStatusIcon /> + <daysSinceFirstVisit>0</daysSinceFirstVisit> + <secondsSinceFirstVisit>0</secondsSinceFirstVisit> + <daysSinceLastEcommerceOrder>0</daysSinceLastEcommerceOrder> + <secondsSinceLastEcommerceOrder /> + <visitDuration>1</visitDuration> + <visitDurationPretty>1s</visitDurationPretty> + <searches>0</searches> + <actions>11</actions> + <interactions>11</interactions> + <referrerType>direct</referrerType> + <referrerTypeName>Direct Entry</referrerTypeName> + <referrerName /> + <referrerKeyword /> + <referrerKeywordPosition /> + <referrerUrl /> + <referrerSearchEngineUrl /> + <referrerSearchEngineIcon /> + <referrerSocialNetworkUrl /> + <referrerSocialNetworkIcon /> + <languageCode>fr</languageCode> + <language>French</language> + <deviceType>Desktop</deviceType> + <deviceTypeIcon>plugins/Morpheus/icons/dist/devices/desktop.png</deviceTypeIcon> + <deviceBrand>Unknown</deviceBrand> + <deviceModel>Generic Desktop</deviceModel> + <operatingSystem>Windows XP</operatingSystem> + <operatingSystemName>Windows</operatingSystemName> + <operatingSystemIcon>plugins/Morpheus/icons/dist/os/WIN.png</operatingSystemIcon> + <operatingSystemCode>WIN</operatingSystemCode> + <operatingSystemVersion>XP</operatingSystemVersion> + <browserFamily>Gecko</browserFamily> + <browserFamilyDescription>Gecko (Firefox)</browserFamilyDescription> + <browser>Firefox 3.6</browser> + <browserName>Firefox</browserName> + <browserIcon>plugins/Morpheus/icons/dist/browsers/FF.png</browserIcon> + <browserCode>FF</browserCode> + <browserVersion>3.6</browserVersion> + <totalEcommerceRevenue>0</totalEcommerceRevenue> + <totalEcommerceConversions>0</totalEcommerceConversions> + <totalEcommerceItems>0</totalEcommerceItems> + <totalAbandonedCartsRevenue>0</totalAbandonedCartsRevenue> + <totalAbandonedCarts>0</totalAbandonedCarts> + <totalAbandonedCartsItems>0</totalAbandonedCartsItems> + <events>0</events> + <continent>Europe</continent> + <continentCode>eur</continentCode> + <country>France</country> + <countryCode>fr</countryCode> + <countryFlag>plugins/Morpheus/icons/dist/flags/fr.png</countryFlag> + <region /> + <regionCode /> + <city /> + <location>France</location> + <latitude /> + <longitude /> + <visitLocalTime>12:34:06</visitLocalTime> + <visitLocalHour>12</visitLocalHour> + <daysSinceLastVisit>0</daysSinceLastVisit> + <secondsSinceLastVisit>0</secondsSinceLastVisit> + <resolution>1024x768</resolution> + <plugins>cookie, flash, java</plugins> + <pluginsIcons> + <row> + <pluginIcon>plugins/Morpheus/icons/dist/plugins/cookie.png</pluginIcon> + <pluginName>cookie</pluginName> + </row> + <row> + <pluginIcon>plugins/Morpheus/icons/dist/plugins/flash.png</pluginIcon> + <pluginName>flash</pluginName> + </row> + <row> + <pluginIcon>plugins/Morpheus/icons/dist/plugins/java.png</pluginIcon> + <pluginName>java</pluginName> + </row> + </pluginsIcons> + <customVariables> + </customVariables> + </row> +</result>
\ No newline at end of file diff --git a/tests/PHPUnit/Fixtures/TwoSitesTwoVisitorsDifferentDays.php b/tests/PHPUnit/Fixtures/TwoSitesTwoVisitorsDifferentDays.php index 987017cbc8..3e6acaf023 100644 --- a/tests/PHPUnit/Fixtures/TwoSitesTwoVisitorsDifferentDays.php +++ b/tests/PHPUnit/Fixtures/TwoSitesTwoVisitorsDifferentDays.php @@ -49,7 +49,8 @@ class TwoSitesTwoVisitorsDifferentDays extends Fixture } if (!self::siteCreated($idSite = 2)) { - self::createWebsite($this->dateTime, 0, "Site 2"); + // set https url in website config, which should convert action urls to https in api response + self::createWebsite($this->dateTime, 0, "Site 2", ['http://piwik.net', 'http://example2.com', 'https://example2.com']); } if ($this->allowConversions) { diff --git a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays__Actions.getPageUrls_day.xml b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays__Actions.getPageUrls_day.xml index 77b364af4d..554ff05540 100644 --- a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays__Actions.getPageUrls_day.xml +++ b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays__Actions.getPageUrls_day.xml @@ -846,7 +846,7 @@ <avg_time_on_page>0</avg_time_on_page> <bounce_rate>0%</bounce_rate> <exit_rate>50%</exit_rate> - <url>http://example2.com/home#notIgnoredFragment</url> + <url>https://example2.com/home#notIgnoredFragment</url> <segment>pageUrl==http%253A%252F%252Fexample2.com%252Fhome%2523notIgnoredFragment</segment> </row> <row> diff --git a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays__Actions.getPageUrls_month.xml b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays__Actions.getPageUrls_month.xml index edc329461b..07ecfaed9e 100644 --- a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays__Actions.getPageUrls_month.xml +++ b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays__Actions.getPageUrls_month.xml @@ -242,7 +242,7 @@ <avg_time_on_page>0</avg_time_on_page> <bounce_rate>0%</bounce_rate> <exit_rate>50%</exit_rate> - <url>http://example2.com/home#notIgnoredFragment</url> + <url>https://example2.com/home#notIgnoredFragment</url> <segment>pageUrl==http%253A%252F%252Fexample2.com%252Fhome%2523notIgnoredFragment</segment> </row> <row> diff --git a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays__Actions.getPageUrls_week.xml b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays__Actions.getPageUrls_week.xml index d7c3d4163c..4f8e42b900 100644 --- a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays__Actions.getPageUrls_week.xml +++ b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays__Actions.getPageUrls_week.xml @@ -425,7 +425,7 @@ <avg_time_on_page>0</avg_time_on_page> <bounce_rate>0%</bounce_rate> <exit_rate>50%</exit_rate> - <url>http://example2.com/home#notIgnoredFragment</url> + <url>https://example2.com/home#notIgnoredFragment</url> <segment>pageUrl==http%253A%252F%252Fexample2.com%252Fhome%2523notIgnoredFragment</segment> </row> <row> diff --git a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays__Actions.getPageUrls_year.xml b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays__Actions.getPageUrls_year.xml index 507895358e..f4c29bb2e6 100644 --- a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays__Actions.getPageUrls_year.xml +++ b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays__Actions.getPageUrls_year.xml @@ -242,7 +242,7 @@ <avg_time_on_page>0</avg_time_on_page> <bounce_rate>0%</bounce_rate> <exit_rate>50%</exit_rate> - <url>http://example2.com/home#notIgnoredFragment</url> + <url>https://example2.com/home#notIgnoredFragment</url> <segment>pageUrl==http%253A%252F%252Fexample2.com%252Fhome%2523notIgnoredFragment</segment> </row> <row> |