title: Tracking desktop app with Google Analytics
body: <p>I want to track a c++ desktop app. I created an account on Google Analytics but I saw only 2 choices : track a web site or a mobile application. I choose mobile application and I received an ID like UA-xxxxxxxx-x . Now, I want to know if it's possible to track a desktop application with that ID, and how. I saw several examples on forums but each time a website is specified, but in my case I don't have any website, I just want to have statistics about my application (what are the features used etc...). </p>
  
  <p>After that, I tried this example I found in Qt (of course there are not the final values)</p>
  
  <pre><code>void Analytics::initialize()
  {
      m_manager = new QNetworkAccessManager(this);
      // Call slot_receive() when reply is received
      QObject::connect(m_manager, SIGNAL(finished(QNetworkReply *)),
                       this, SLOT(slot_receive(QNetworkReply *)));
  
      // Send requests to Google Analytics while app is running
      QTimer * timer = new QTimer(this);
      connect(timer, SIGNAL(timeout()), this, SLOT(slot_requestAnalyticsView()));
      timer-&gt;start(5 * 60 * 1000); // send requests every 5 minutes
      slot_requestAnalyticsView(); // send first request
  } 
  
  
  void Analytics::slot_requestAnalyticsView()
  {
      // 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 += "&amp;t=pageview"; // type of request
      requestParams += "&amp;tid="; // Google Analytics account
      requestParams += ANALYTICS_ID;
  
      requestParams += "&amp;cid=";
      requestParams += getMacAddress(); // unique user identifier
      requestParams += "&amp;dp=foobar"; // name of page (or app name)
      requestParams += "&amp;ul=" + QLocale::system().name(); // language
  
      // send request via post method
  
      QString qPost = request.url().toString() + QString( "?" ) + requestParams;
      qDebug() &lt;&lt; "\nPOST = " &lt;&lt; qPost &lt;&lt; "\n";
      m_manager-&gt;post(request, requestParams.toStdString().c_str());
  } 
  
  void Analytics::slot_receive(QNetworkReply * reply)
  {
       // Output information about reply
      qDebug()&lt;&lt;"RequestUrl:" &lt;&lt; reply-&gt;request().url();
      qDebug()&lt;&lt;"Status:" &lt;&lt; reply-&gt;attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
      qDebug()&lt;&lt;"Error:"&lt;&lt; reply-&gt;error();
      QByteArray bytes=reply-&gt;readAll();
      qDebug()&lt;&lt;"Contents" &lt;&lt; QString::fromUtf8(bytes.data(), bytes.size());
  } 
  </code></pre>
  
  <p>and I put that code on my app, but each time I execute it, "slot_receive" is never called and there is no change on my statistic page on Google Analytics.</p>
  
  <p>Thanks.</p>