summaryrefslogtreecommitdiffstats
path: root/libraries/ganalytics
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/ganalytics')
-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
4 files changed, 20 insertions, 2 deletions
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;