How to get list of trackable QR Codes
using Esponce.QRCode
...
//API key for authentication
string auth = "2d7c35924fb7476a929d250b00956e36";

var client = new QRCodeClient();
client.UseSSL = true;
client.ApiKey = auth;

var list = client.GetTrackList();
foreach (var item in list.QRCodes)
{
  //Get QR Code identifier
  string id = item.Id;
}

Get scans by day
//QR Code identifier
string id = "c2c5d6541f1b4c0da95d00fa24535aaa";

//API key for authentication
string auth = "2d7c35924fb7476a929d250b00956e36";

var helper = new QRCodeStatistics(auth);
var scans = helper.GetScansByDay(id);
foreach (var scan in scans)
{
  //Displays as "n: yyyy-MM-dd" where "n" is number of scans for the day
  Console.WriteLine(scan.Count + ": " + scan.Date.ToString("yyyy-MM-dd"));
}

Get scans by country
var helper = new QRCodeStatistics("2d7c35924fb7476a929d250b00956e36");
var scans = helper.GetScansByCountry("c2c5d6541f1b4c0da95d00fa24535aaa");
foreach (var scan in scans)
{
  //Displays as "n: cc (English name)" where "n" is number of scans and "cc" two-letter country code
  Console.WriteLine(scan.Count + ": " + scan.CountryCode + "(" + LocationHelper.GetCountryName(scan.CountryCode) + ")");
}

Handling statistics more efficiently
var client = new QRCodeClient();
client.UseSSL = true;
client.ApiKey = "2d7c35924fb7476a929d250b00956e36";
var helper = new QRCodeStatistics(client);

//Get individual scan records
string id = "c2c5d6541f1b4c0da95d00fa24535aaa";
var scans = helper.GetRecords(id);

//Group by day, device and country
var scansByDay = helper.GetScansByDay(scans);
var scansByDevice = helper.GetScansByDevice(scans);
var scansByCountry = helper.GetScansByCountry(scans);

Last edited Oct 10, 2012 at 9:08 AM by Avivo, version 1

Comments

No comments yet.