public WWW RequestHeatmapData(List<string> events, string area, string build, DateTime? startDate, DateTime? endDate, SubmitSuccessHandler successEvent, SubmitErrorHandler errorEvent)
{
string game_key = GA.SettingsGA.GameKey;
string event_ids = "";
for (int i = 0; i < events.Count; i++)
{
if (i == events.Count - 1)
event_ids += events[i];
else
event_ids += events[i] + "|";
}
string requestInfo = "game_key=" + game_key + "&event_ids=" + event_ids + "&area=" + area;
if (!build.Equals(""))
requestInfo += "&build=" + build;
requestInfo = requestInfo.Replace(" ", "%20");
if (startDate.HasValue && endDate.HasValue)
{
DateTime startDT = new DateTime(startDate.Value.Year, startDate.Value.Month, startDate.Value.Day, 0, 0, 0);
DateTime endDT = new DateTime(endDate.Value.Year, endDate.Value.Month, endDate.Value.Day, 0, 0, 0);
requestInfo += "&start_ts=" + DateTimeToUnixTimestamp(startDT) + "&end_ts=" + DateTimeToUnixTimestamp(endDT);
}
//Get the url with the request type
string url = GetURL(Requests[RequestType.GA_GetHeatmapData]);
url += "/?" + requestInfo;
WWW www = null;
#if !UNITY_WP8 && !UNITY_METRO
//Set the authorization header to contain an MD5 hash of the JSON array string + the private key
Hashtable headers = new Hashtable();
headers.Add("Authorization", GA.API.Submit.CreateMD5Hash(requestInfo + GA.SettingsGA.ApiKey));
//Try to send the data
www = new WWW(url, new byte[] { 0 }, headers);
#else
//Set the authorization header to contain an MD5 hash of the JSON array string + the private key
Dictionary<string, string> headers = new Dictionary<string, string>();
headers.Add("Authorization", GA.API.Submit.CreateMD5Hash(requestInfo + GA.SettingsGA.ApiKey));
//Try to send the data
www = new WWW(url, new byte[] { 0 }, headers);
#endif
GA.RunCoroutine(Request(www, RequestType.GA_GetHeatmapData, successEvent, errorEvent),()=>www.isDone);
return www;
}