summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2016-11-21 21:18:30 +0100
committerPetr Mrázek <peterix@gmail.com>2016-11-21 21:18:30 +0100
commitee6f2f0a8ebdeede68b6768e1d75d047ec2c50de (patch)
treec6eb6056e54d51dce33c46cd28b1cc920f144dde
parent95f961fb6102f782482c057f51dae8ae8aed966c (diff)
downloadMultiMC-ee6f2f0a8ebdeede68b6768e1d75d047ec2c50de.tar
MultiMC-ee6f2f0a8ebdeede68b6768e1d75d047ec2c50de.tar.gz
MultiMC-ee6f2f0a8ebdeede68b6768e1d75d047ec2c50de.tar.lz
MultiMC-ee6f2f0a8ebdeede68b6768e1d75d047ec2c50de.tar.xz
MultiMC-ee6f2f0a8ebdeede68b6768e1d75d047ec2c50de.zip
NOISSUE implement analytics IP anonymization
-rw-r--r--application/MultiMC.cpp1
-rw-r--r--libraries/ganalytics/include/ganalytics.h3
-rw-r--r--libraries/ganalytics/src/ganalytics.cpp10
-rw-r--r--libraries/ganalytics/src/ganalytics_worker.cpp6
-rw-r--r--libraries/ganalytics/src/ganalytics_worker.h3
5 files changed, 21 insertions, 2 deletions
diff --git a/application/MultiMC.cpp b/application/MultiMC.cpp
index c3ab7827..49e45c41 100644
--- a/application/MultiMC.cpp
+++ b/application/MultiMC.cpp
@@ -527,6 +527,7 @@ void MultiMC::initAnalytics()
}
m_analytics = new GAnalytics(BuildConfig.ANALYTICS_ID, clientID, this);
m_analytics->setLogLevel(GAnalytics::Debug);
+ m_analytics->setAnonymizeIPs(true);
m_analytics->setNetworkAccessManager(&ENV.qnam());
m_analytics->startSending();
qDebug() << "Initialized analytics with tid" << BuildConfig.ANALYTICS_ID << "and cid" << clientID;
diff --git a/libraries/ganalytics/include/ganalytics.h b/libraries/ganalytics/include/ganalytics.h
index 7cbd2c85..48025dc1 100644
--- a/libraries/ganalytics/include/ganalytics.h
+++ b/libraries/ganalytics/include/ganalytics.h
@@ -33,6 +33,9 @@ public:
void setLanguage(const QString &language);
QString language() const;
+ void setAnonymizeIPs(bool anonymize);
+ bool anonymizeIPs();
+
void setSendInterval(int milliseconds);
int sendInterval() const;
diff --git a/libraries/ganalytics/src/ganalytics.cpp b/libraries/ganalytics/src/ganalytics.cpp
index 8d25efe9..a03dfcad 100644
--- a/libraries/ganalytics/src/ganalytics.cpp
+++ b/libraries/ganalytics/src/ganalytics.cpp
@@ -60,6 +60,16 @@ QString GAnalytics::language() const
return d->m_language;
}
+void GAnalytics::setAnonymizeIPs(bool anonymize)
+{
+ d->m_anonymizeIPs = anonymize;
+}
+
+bool GAnalytics::anonymizeIPs()
+{
+ return d->m_anonymizeIPs;
+}
+
void GAnalytics::setSendInterval(int milliseconds)
{
d->m_timer.setInterval(milliseconds);
diff --git a/libraries/ganalytics/src/ganalytics_worker.cpp b/libraries/ganalytics/src/ganalytics_worker.cpp
index 01aa69ce..2b03e14c 100644
--- a/libraries/ganalytics/src/ganalytics_worker.cpp
+++ b/libraries/ganalytics/src/ganalytics_worker.cpp
@@ -12,7 +12,7 @@
const QLatin1String GAnalyticsWorker::dateTimeFormat("yyyy,MM,dd-hh:mm::ss:zzz");
GAnalyticsWorker::GAnalyticsWorker(GAnalytics *parent)
- : QObject(parent), q(parent), m_logLevel(GAnalytics::Error), m_isSending(false)
+ : QObject(parent), q(parent), m_logLevel(GAnalytics::Error)
{
m_appName = QCoreApplication::instance()->applicationName();
m_appVersion = QCoreApplication::instance()->applicationVersion();
@@ -57,6 +57,10 @@ QUrlQuery GAnalyticsWorker::buildStandardPostQuery(const QString &type)
query.addQueryItem("ul", m_language);
query.addQueryItem("vp", m_viewportSize);
query.addQueryItem("sr", m_screenResolution);
+ if(m_anonymizeIPs)
+ {
+ query.addQueryItem("aip", "1");
+ }
return query;
}
diff --git a/libraries/ganalytics/src/ganalytics_worker.h b/libraries/ganalytics/src/ganalytics_worker.h
index 280f9ab2..88fa223a 100644
--- a/libraries/ganalytics/src/ganalytics_worker.h
+++ b/libraries/ganalytics/src/ganalytics_worker.h
@@ -37,7 +37,8 @@ public:
QString m_screenResolution;
QString m_viewportSize;
- bool m_isSending;
+ bool m_anonymizeIPs = false;
+ bool m_isSending = false;
const static int fourHours = 4 * 60 * 60 * 1000;
const static QLatin1String dateTimeFormat;