Commit 8e5a3ed7 authored by Scott Petrovic's avatar Scott Petrovic

Add analytics tracking to startup screen for Matomo

parent dcdef2ea
...@@ -120,6 +120,10 @@ void KisWelcomePageWidget::setMainWindow(KisMainWindow* mainWin) ...@@ -120,6 +120,10 @@ void KisWelcomePageWidget::setMainWindow(KisMainWindow* mainWin)
connect(clearRecentFilesLink, SIGNAL(clicked(bool)), this, SLOT(slotClearRecentFiles())); connect(clearRecentFilesLink, SIGNAL(clicked(bool)), this, SLOT(slotClearRecentFiles()));
slotUpdateThemeColors(); slotUpdateThemeColors();
// allows RSS news items to apply analytics tracking.
newsWidget->setAnalyticsTracking("?" + analyticsString);
} }
} }
...@@ -186,13 +190,26 @@ void KisWelcomePageWidget::slotUpdateThemeColors() ...@@ -186,13 +190,26 @@ void KisWelcomePageWidget::slotUpdateThemeColors()
kdeIcon->setIcon(KisIconUtils::loadIcon(QStringLiteral("kde")).pixmap(20)); kdeIcon->setIcon(KisIconUtils::loadIcon(QStringLiteral("kde")).pixmap(20));
// HTML links seem to be a bit more stubborn with theme changes... setting inline styles to help with color change // HTML links seem to be a bit more stubborn with theme changes... setting inline styles to help with color change
userCommunityLink->setText(QString("<a style=\"color: " + blendedColor.name() + " \" href=\"https://forum.kde.org/viewforum.php?f=136\">").append(i18n("User Community")).append("</a>")); userCommunityLink->setText(QString("<a style=\"color: " + blendedColor.name() + " \" href=\"https://forum.kde.org/viewforum.php?f=136&" + analyticsString + "user-community" + "\">")
gettingStartedLink->setText(QString("<a style=\"color: " + blendedColor.name() + " \" href=\"https://docs.krita.org/en/user_manual/getting_started.html\">").append(i18n("Getting Started")).append("</a>")); .append(i18n("User Community")).append("</a>"));
manualLink->setText(QString("<a style=\"color: " + blendedColor.name() + " \" href=\"https://docs.krita.org/\">").append(i18n("User Manual")).append("</a>"));
supportKritaLink->setText(QString("<a style=\"color: " + blendedColor.name() + " \" href=\"https://krita.org/en/support-us/donations/\">").append(i18n("Support Krita")).append("</a>")); gettingStartedLink->setText(QString("<a style=\"color: " + blendedColor.name() + " \" href=\"https://docs.krita.org/en/user_manual/getting_started.html?" + analyticsString + "getting-started" + "\">")
kritaWebsiteLink->setText(QString("<a style=\"color: " + blendedColor.name() + " \" href=\"https://www.krita.org\">").append(i18n("Krita Website")).append("</a>")); .append(i18n("Getting Started")).append("</a>"));
sourceCodeLink->setText(QString("<a style=\"color: " + blendedColor.name() + " \" href=\"https://phabricator.kde.org/source/krita/\">").append(i18n("Source Code")).append("</a>"));
poweredByKDELink->setText(QString("<a style=\"color: " + blendedColor.name() + " \" href=\"https://userbase.kde.org/What_is_KDE\">").append(i18n("Powered by KDE")).append("</a>")); manualLink->setText(QString("<a style=\"color: " + blendedColor.name() + " \" href=\"https://docs.krita.org?" + analyticsString + "documentation-site" + "\">")
.append(i18n("User Manual")).append("</a>"));
supportKritaLink->setText(QString("<a style=\"color: " + blendedColor.name() + " \" href=\"https://krita.org/en/support-us/donations?" + analyticsString + "donations" + "\">")
.append(i18n("Support Krita")).append("</a>"));
kritaWebsiteLink->setText(QString("<a style=\"color: " + blendedColor.name() + " \" href=\"https://www.krita.org?" + analyticsString + "marketing-site" + "\">")
.append(i18n("Krita Website")).append("</a>"));
sourceCodeLink->setText(QString("<a style=\"color: " + blendedColor.name() + " \" href=\"https://invent.kde.org/kde/krita?" + analyticsString + "source-code" + "\">")
.append(i18n("Source Code")).append("</a>"));
poweredByKDELink->setText(QString("<a style=\"color: " + blendedColor.name() + " \" href=\"https://userbase.kde.org/What_is_KDE?" + analyticsString + "what-is-kde" + "\">")
.append(i18n("Powered by KDE")).append("</a>"));
// re-populate recent files since they might have themed icons // re-populate recent files since they might have themed icons
populateRecentDocuments(); populateRecentDocuments();
......
...@@ -65,6 +65,14 @@ private: ...@@ -65,6 +65,14 @@ private:
QMap<QString, QIcon> m_thumbnailMap; QMap<QString, QIcon> m_thumbnailMap;
/// help us see how many people are clicking startup screen links
/// you can see the results in Matomo (stats.kde.org)
/// this will be listed in the "Acquisition" section of Matomo
/// just append some text to this to associate it with an event/page
const QString analyticsString = "pk_campaign=startup-sceen&pk_kwd=";
private Q_SLOTS: private Q_SLOTS:
void slotNewFileClicked(); void slotNewFileClicked();
void slotOpenFileClicked(); void slotOpenFileClicked();
......
...@@ -89,6 +89,11 @@ KisNewsWidget::KisNewsWidget(QWidget *parent) ...@@ -89,6 +89,11 @@ KisNewsWidget::KisNewsWidget(QWidget *parent)
connect(listNews, SIGNAL(clicked(QModelIndex)), this, SLOT(itemSelected(QModelIndex))); connect(listNews, SIGNAL(clicked(QModelIndex)), this, SLOT(itemSelected(QModelIndex)));
} }
void KisNewsWidget::setAnalyticsTracking(QString text)
{
analyticsTrackingParameters = text;
}
void KisNewsWidget::toggleNews(bool toggle) void KisNewsWidget::toggleNews(bool toggle)
{ {
KisConfig cfg(false); KisConfig cfg(false);
...@@ -106,6 +111,22 @@ void KisNewsWidget::itemSelected(const QModelIndex &idx) ...@@ -106,6 +111,22 @@ void KisNewsWidget::itemSelected(const QModelIndex &idx)
{ {
if (idx.isValid()) { if (idx.isValid()) {
QString link = idx.data(RssRoles::LinkRole).toString(); QString link = idx.data(RssRoles::LinkRole).toString();
QDesktopServices::openUrl(QUrl(link));
// append query string for analytics tracking if we set it
if (analyticsTrackingParameters != "") {
// use title in analytics query string
QString linkTitle = idx.data(RssRoles::TitleRole).toString();
linkTitle = linkTitle.simplified(); // trims and makes 1 white space
linkTitle = linkTitle.replace(" ", "");
analyticsTrackingParameters = analyticsTrackingParameters.append(linkTitle);
QDesktopServices::openUrl(QUrl(link.append(analyticsTrackingParameters)));
} else {
QDesktopServices::openUrl(QUrl(link));
}
} }
} }
...@@ -44,7 +44,7 @@ class KisNewsWidget : public QWidget, public Ui::KisNewsPage ...@@ -44,7 +44,7 @@ class KisNewsWidget : public QWidget, public Ui::KisNewsPage
public: public:
explicit KisNewsWidget(QWidget *parent = nullptr); explicit KisNewsWidget(QWidget *parent = nullptr);
void setAnalyticsTracking(QString text);
private Q_SLOTS: private Q_SLOTS:
void toggleNews(bool toggle); void toggleNews(bool toggle);
...@@ -52,6 +52,7 @@ private Q_SLOTS: ...@@ -52,6 +52,7 @@ private Q_SLOTS:
private: private:
bool m_getNews {false}; bool m_getNews {false};
MultiFeedRssModel *m_rssModel {0}; MultiFeedRssModel *m_rssModel {0};
QString analyticsTrackingParameters;
}; };
#endif // KISNEWSWIDGET_H #endif // KISNEWSWIDGET_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment