public async void PostSessionEnd() { GetGoogleAnalytics.PostSessionEnd(); int version = GetVersion(); var hitType = "End"; try { HttpContent content = new StringContent("{" + "\"did\":\"" + deviceId + "\"," + "\"cid\":\"" + campaignId + "\"," + "\"v\":\"" + version + "\"," + "\"t\":\"" + hitType + "\"" + "}"); await CustomPost(content); return; } catch (Exception ex) { Debug.WriteLine(ex); } return; }
public async void PostView(string page, string pageTitle) { GetGoogleAnalytics.PostView( HttpUtility.UrlEncode(page), HttpUtility.UrlEncode(pageTitle) ); int version = GetVersion(); var hitType = "Pageview"; try { HttpContent content = new StringContent("{" + "\"did\":\"" + deviceId + "\"," + "\"cid\":\"" + campaignId + "\"," + "\"v\":\"" + version + "\"," + "\"t\":\"" + hitType + "\"," + "\"dp\":\"" + page + "\"," + "\"dt\":\"" + pageTitle + "\"" + "}"); await CustomPost(content); return; } catch (Exception ex) { // Write out any exceptions. Debug.WriteLine(ex); } return; }
public async void PostEvent(string page, string pageTitle, string category, string label, string action) { GetGoogleAnalytics.PostEvent( HttpUtility.UrlEncode(page), HttpUtility.UrlEncode(pageTitle), HttpUtility.UrlEncode(category), HttpUtility.UrlEncode(label), HttpUtility.UrlEncode(action) ); int version = GetVersion(); var hitType = "Event"; try { HttpContent content = new StringContent("{" + "\"did\":\"" + deviceId + "\"," + "\"cid\":\"" + campaignId + "\"," + "\"v\":\"" + version + "\"," + "\"t\":\"" + hitType + "\"," + "\"dp\":\"" + page + "\"," + "\"dt\":\"" + pageTitle + "\"," + "\"ec\":\"" + category + "\"," + "\"el\":\"" + label + "\"," + "\"ea\":\"" + action + "\"" + "}"); await CustomPost(content); return; } catch (Exception ex) { // Write out any exceptions. Debug.WriteLine(ex); } return; }