Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add possibility to ignore "no data recorded" screen for one hour #11686

Merged
merged 4 commits into from May 12, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions plugins/SitesManager/Controller.php
Expand Up @@ -13,6 +13,7 @@
use Piwik\Common;
use Piwik\Exception\UnexpectedWebsiteFoundException;
use Piwik\Piwik;
use Piwik\Session;
use Piwik\Settings\Measurable\MeasurableSettings;
use Piwik\SettingsPiwik;
use Piwik\Site;
Expand Down Expand Up @@ -130,6 +131,18 @@ function downloadPiwikTracker()
return file_get_contents($path . $filename);
}

public function ignoreNoDataMessage()
{
Piwik::checkUserHasSomeViewAccess();

$session = new Session\SessionNamespace('siteWithoutData');
$session->ignoreMessage = true;
$session->setExpirationSeconds($oneHour = 60 * 60);

$url = Url::getCurrentUrlWithoutQueryString() . Url::getCurrentQueryStringWithParametersModified(array('module' => 'CoreHome', 'action' => 'index'));
Url::redirectToUrl($url);
}

public function siteWithoutData()
{
$javascriptGenerator = new TrackerCodeGenerator();
Expand Down
6 changes: 6 additions & 0 deletions plugins/SitesManager/SitesManager.php
Expand Up @@ -17,6 +17,7 @@
use Piwik\Settings\Storage\Backend\MeasurableSettingsTable;
use Piwik\Tracker\Cache;
use Piwik\Tracker\Model as TrackerModel;
use Piwik\Session\SessionNamespace;

/**
*
Expand Down Expand Up @@ -61,6 +62,11 @@ public function redirectDashboardToWelcomePage(&$module, &$action)

$trackerModel = new TrackerModel();
if ($trackerModel->isSiteEmpty($siteId)) {
$session = new SessionNamespace('siteWithoutData');
if (!empty($session->ignoreMessage)) {
return;
}

$module = 'SitesManager';
$action = 'siteWithoutData';
}
Expand Down
1 change: 1 addition & 0 deletions plugins/SitesManager/lang/en.json
Expand Up @@ -76,6 +76,7 @@
"SiteWithoutDataSetupTracking": "Please set up the %1$stracking code%2$s below into your website or mobile app if you haven't done already.",
"SiteWithoutDataMessageDisappears": "This message will disappear as soon as some data was tracked for this website.",
"SiteWithoutDataSetupGoals": "In the meantime, maybe you would like to %1$sset up some goals%2$s or learn more about the %3$sfeatures%4$s of Piwik in one of our %5$sguides%6$s or %7$sFAQs%8$s.",
"SiteWithoutDataIgnoreMessage": "Ignore this message for the next hour",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of Ignore maybe Hide or Don't show sounds a bit less negative

"SuperUserAccessCan": "A user with Super User access can also %1$s specify global settings%2$s for new websites.",
"Timezone": "Time zone",
"TrackingSiteSearch": "Tracking Internal Site Search",
Expand Down
5 changes: 5 additions & 0 deletions plugins/SitesManager/templates/siteWithoutData.twig
Expand Up @@ -45,6 +45,11 @@
'<a href="https://piwik.org/features/" rel="noreferrer" target="_blank">', "</a>",
'<a href="https://piwik.org/docs/" rel="noreferrer" target="_blank">', "</a>",
'<a href="https://piwik.org/faq/" rel="noreferrer" target="_blank">', "</a>")|raw }}

<br />
<br />
<a href="{{ linkTo({module: 'SitesManager', action: 'ignoreNoDataMessage'}) }}"
class="btn ignoreSitesWithoutData">{{ 'SitesManager_SiteWithoutDataIgnoreMessage'|translate }}</a>
</p>

{{ trackingHelp|raw }}
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions tests/UI/specs/EmptySite_spec.js
Expand Up @@ -19,4 +19,11 @@ describe("EmptySite", function () {
page.load(urlToTest);
}, done);
});

it('should be possible to ignore this screen for one hour', function (done) {
expect.screenshot('emptySiteDashboard_ignored').to.be.captureSelector('.page', function (page) {
page.click('.ignoreSitesWithoutData');
page.wait(1000)
}, done);
});
});