1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-23 16:25:16 +03:00

Google analytics removed. Completely wrong, we use the compilation

server numbers instead.
This commit is contained in:
bsongis 2014-06-13 10:13:44 +02:00
parent cedac96cf4
commit 2fbd68ecb3
11 changed files with 1 additions and 124 deletions

View file

@ -130,15 +130,10 @@ set(common_SRCS
firmwares/opentx/opentxM128simulator.cpp firmwares/opentx/opentxM128simulator.cpp
firmwares/opentx/opentxM64simulator.cpp firmwares/opentx/opentxM64simulator.cpp
file.cpp file.cpp
googleanalytics.cpp
appdata.cpp appdata.cpp
) )
set(common_MOC_HDRS qt4_wrap_cpp(common_SRCS)
googleanalytics.h
)
qt4_wrap_cpp( common_SRCS ${common_MOC_HDRS} )
add_library(common ${common_SRCS}) add_library(common ${common_SRCS})

View file

@ -3,7 +3,6 @@
#include <QtGui> #include <QtGui>
#include "eeprominterface.h" #include "eeprominterface.h"
#include "flashinterface.h" #include "flashinterface.h"
#include "googleanalytics.h"
#if defined WIN32 || !defined __GNUC__ #if defined WIN32 || !defined __GNUC__
#include <Windows.h> #include <Windows.h>
@ -94,8 +93,6 @@ avrOutputDialog::avrOutputDialog(QWidget *parent, QString prog, QStringList arg,
process->start(prog,arg); process->start(prog,arg);
} }
} }
ga.sendPageView(getBoardName(GetCurrentFirmware()->getBoard()) + " Flash");
} }
# if !__GNUC__ # if !__GNUC__

View file

@ -4,7 +4,6 @@
#include "appdata.h" #include "appdata.h"
#include <QDateTime> #include <QDateTime>
#include <QtGui> #include <QtGui>
#include "googleanalytics.h"
#define BIT_WARN_THR ( 0x01 ) #define BIT_WARN_THR ( 0x01 )
#define BIT_WARN_SW ( 0x02 ) #define BIT_WARN_SW ( 0x02 )
@ -318,8 +317,6 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
} }
disableMouseScrolling(); disableMouseScrolling();
ga.sendPageView(getBoardName(GetCurrentFirmware()->getBoard()) + " GeneralEdit");
} }
GeneralEdit::~GeneralEdit() GeneralEdit::~GeneralEdit()

View file

@ -1,73 +0,0 @@
#include "googleanalytics.h"
#include <QtGui>
#define TRACKING_ID "UA-40098569-1"
GoogleAnalytics ga;
GoogleAnalytics::GoogleAnalytics():
userId(qrand()),
networkManager(new QNetworkAccessManager(this))
{
}
GoogleAnalytics::~GoogleAnalytics()
{
delete networkManager;
}
void GoogleAnalytics::sendPageView(QString title)
{
// create request and set URL of receiver
QNetworkRequest request;
QUrl host("http://www.google-analytics.com/collect");
request.setUrl(host);
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
// setup parameters of request
QString requestParams;
requestParams += "v=1"; // version of protocol
requestParams += "&t=pageview"; // type of request
requestParams += "&tid=" TRACKING_ID; // Google Analytics account
requestParams += "&cid=" + QString::number(userId); // unique user identifier
requestParams += "&dp=companion-" + title.toLower().replace(" ", "-"); // name of page
requestParams += "&dt=" + title; // title of page
requestParams += "&ul=" + QLocale::system().name(); // language
// send request via post method
networkManager->post(request, requestParams.toStdString().c_str());
}
void GoogleAnalytics::sendEvent(QString category, QString action, QString label)
{
// create request and set URL of receiver
QNetworkRequest request;
QUrl host("http://www.google-analytics.com/collect");
request.setUrl(host);
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
// setup parameters of request
QString requestParams;
requestParams += "v=1"; // version of protocol
requestParams += "&t=event"; // type of request
requestParams += "&ec=" + category;
requestParams += "&ea=" + action;
requestParams += "&el=" + label;
requestParams += "&tid=" TRACKING_ID; // Google Analytics account
requestParams += "&cid=" + QString::number(userId); // unique user identifier
requestParams += "&dt=Companion"; // name of page (or app name)
requestParams += "&ul=" + QLocale::system().name(); // language
// send request via post method
networkManager->post(request, requestParams.toStdString().c_str());
}
void GoogleAnalytics::slot_receive(QNetworkReply * reply)
{
// output information about reply
qDebug() << "RequestUrl:" << reply->request().url();
qDebug() << "Status:" << reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
qDebug() << "Error:"<< reply->error();
QByteArray bytes = reply->readAll();
qDebug() << "Contents" << QString::fromUtf8(bytes.data(), bytes.size());
}

View file

@ -1,21 +0,0 @@
#include <QtNetwork>
class GoogleAnalytics: public QObject
{
Q_OBJECT
public:
GoogleAnalytics();
~GoogleAnalytics();
void sendPageView(QString page);
void sendEvent(QString category, QString action, QString label="");
protected slots:
void slot_receive(QNetworkReply * reply);
protected:
int userId;
QNetworkAccessManager * networkManager;
};
extern GoogleAnalytics ga;

View file

@ -64,7 +64,6 @@
#include "helpers.h" #include "helpers.h"
#include "appdata.h" #include "appdata.h"
#include "radionotfound.h" #include "radionotfound.h"
#include "googleanalytics.h"
#include "firmwares/opentx/opentxinterface.h" // TODO get rid of this include #include "firmwares/opentx/opentxinterface.h" // TODO get rid of this include
#define DONATE_STR "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QUZ48K4SEXDP2" #define DONATE_STR "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QUZ48K4SEXDP2"
@ -164,8 +163,6 @@ MainWindow::MainWindow():
if (printing) { if (printing) {
QTimer::singleShot(0, this, SLOT(autoClose())); QTimer::singleShot(0, this, SLOT(autoClose()));
} }
ga.sendPageView("Home");
} }
void MainWindow::displayWarnings() void MainWindow::displayWarnings()
@ -512,7 +509,6 @@ void MainWindow::startFirmwareDownload()
downloadDialog * dd = new downloadDialog(this, url, filename); downloadDialog * dd = new downloadDialog(this, url, filename);
connect(dd, SIGNAL(accepted()), this, SLOT(firmwareDownloadAccepted())); connect(dd, SIGNAL(accepted()), this, SLOT(firmwareDownloadAccepted()));
dd->exec(); dd->exec();
ga.sendEvent(getBoardName(GetCurrentFirmware()->getBoard()), "Download", url);
} }
} }

View file

@ -54,7 +54,6 @@
#include "appdata.h" #include "appdata.h"
#include "wizarddialog.h" #include "wizarddialog.h"
#include <QFileInfo> #include <QFileInfo>
#include "googleanalytics.h"
#if defined WIN32 || !defined __GNUC__ #if defined WIN32 || !defined __GNUC__
#include <windows.h> #include <windows.h>
@ -80,8 +79,6 @@ MdiChild::MdiChild():
if (!(this->isMaximized() || this->isMinimized())) { if (!(this->isMaximized() || this->isMinimized())) {
adjustSize(); adjustSize();
} }
ga.sendPageView(getBoardName(firmware->getBoard()) + " Models");
} }
MdiChild::~MdiChild() MdiChild::~MdiChild()

View file

@ -13,7 +13,6 @@
#include "telemetry.h" #include "telemetry.h"
#include "appdata.h" #include "appdata.h"
#include <QScrollArea> #include <QScrollArea>
#include "googleanalytics.h"
ModelEdit::ModelEdit(QWidget * parent, RadioData & radioData, int modelId, FirmwareInterface * firmware) : ModelEdit::ModelEdit(QWidget * parent, RadioData & radioData, int modelId, FirmwareInterface * firmware) :
QDialog(parent), QDialog(parent),
@ -43,8 +42,6 @@ ModelEdit::ModelEdit(QWidget * parent, RadioData & radioData, int modelId, Firmw
addTab(new TelemetryPanel(this, model, generalSettings, firmware), tr("Telemetry")); addTab(new TelemetryPanel(this, model, generalSettings, firmware), tr("Telemetry"));
connect(setupPanel, SIGNAL(extendedLimitsToggled()), chnPanel, SLOT(refreshExtendedLimits())); connect(setupPanel, SIGNAL(extendedLimitsToggled()), chnPanel, SLOT(refreshExtendedLimits()));
ga.sendPageView(getBoardName(firmware->getBoard()) + " ModelEdit");
} }
ModelEdit::~ModelEdit() ModelEdit::~ModelEdit()

View file

@ -6,7 +6,6 @@
#include <QImage> #include <QImage>
#include <QColor> #include <QColor>
#include <QPainter> #include <QPainter>
#include "googleanalytics.h"
#if !defined WIN32 && defined __GNUC__ #if !defined WIN32 && defined __GNUC__
#include <unistd.h> #include <unistd.h>
@ -62,8 +61,6 @@ PrintDialog::PrintDialog(QWidget *parent, FirmwareInterface * firmware, GeneralS
printToFile(); printToFile();
QTimer::singleShot(0, this, SLOT(autoClose())); QTimer::singleShot(0, this, SLOT(autoClose()));
} }
ga.sendPageView(getBoardName(GetCurrentFirmware()->getBoard()) + " ModelsPrint");
} }
void PrintDialog::closeEvent(QCloseEvent *event) void PrintDialog::closeEvent(QCloseEvent *event)

View file

@ -4,7 +4,6 @@
#include <iostream> #include <iostream>
#include "helpers.h" #include "helpers.h"
#include "simulatorinterface.h" #include "simulatorinterface.h"
#include "googleanalytics.h"
#define GBALL_SIZE 20 #define GBALL_SIZE 20
#define RESX 1024 #define RESX 1024
@ -24,7 +23,6 @@ SimulatorDialog::SimulatorDialog(QWidget * parent, unsigned int flags):
trimPressed (TRIM_NONE), trimPressed (TRIM_NONE),
middleButtonPressed(false) middleButtonPressed(false)
{ {
ga.sendPageView(getBoardName(GetCurrentFirmware()->getBoard()) + " Simulator");
} }
uint32_t SimulatorDialog9X::switchstatus = 0; uint32_t SimulatorDialog9X::switchstatus = 0;

View file

@ -16,7 +16,6 @@
#include "wizarddialog.h" #include "wizarddialog.h"
#include "wizarddata.h" #include "wizarddata.h"
#include "helpers.h" #include "helpers.h"
#include "googleanalytics.h"
WizardDialog::WizardDialog(const GeneralSettings & settings, unsigned int modelId, QWidget *parent): WizardDialog::WizardDialog(const GeneralSettings & settings, unsigned int modelId, QWidget *parent):
QWizard(parent), QWizard(parent),
@ -60,8 +59,6 @@ WizardDialog::WizardDialog(const GeneralSettings & settings, unsigned int modelI
setOption(QWizard::NoCancelButton, false); setOption(QWizard::NoCancelButton, false);
setOption(HaveHelpButton, true); setOption(HaveHelpButton, true);
connect(this, SIGNAL(helpRequested()), this, SLOT(showHelp())); connect(this, SIGNAL(helpRequested()), this, SLOT(showHelp()));
ga.sendPageView("Wizard");
} }
void WizardDialog::showHelp() void WizardDialog::showHelp()