The goal of this document is to explain usage rules of Cobub Razor Windows Phone SDK for facilitating mobile app developers.
This document is for Windows Phone SDK developers, which uses the Open Source Mobile Analytics – Cobub Razor.
Cobub Razor - The Open Source Mobile Analytics
First please setup the Web Server of Cobub Razor (instruction), then register App at web server and fill App info after login. Once App is created successfully, you could obtain AppKey.
Import Windows Phone SDK into your project.
VS users right click own project “Reference” directory and select “Add Reference —>Browse”. Then select path of UMSAgent.dll. Click OK and then import is completed.
We recommend you Calling
in all pages. If not , Page View report and some related data statistics reports will not be available on the Web Server.
UMSAgent.UMSApi.onAppStart(string appKey,string url) Appkey: the key of App, which is produced by the server;
url: the url of your server.
You MUST invoke this API in Application_Launching(object sender, LaunchingEventArgs e) method of the APP.xmal.cs file .
Otherwise, the SDK will not work and other APIs of this SDK bellow can not be used.
UMSAgent.UMSApi.setDebugMode(boolean isDebugMode); isDebugMode
true: show Exception logs;
false: not show;
If you want to monitor errors or exceptions, invoke this API, only the errors and exceptions which ocuur after calling this method will be catched.
UmsAgent. UMSApi.updateOnlineConfig(); Invoke this API in Application_Launching(object sender, LaunchingEventArgs e) and SDK will get your online configuration on the server and store this info in local.
If you don’t invoke this API, SDK will give you a default report policy to deal with the data to be uploaded to server. The version is set in the Version value in WMAppManifest.xml file.
UMSAgent.UMSApi.getNewVersion(); Invoke this API when you want the APP to check that whether Web Server has a new version of the App automatically.
If you have created a new version on the Web Server, your App will notify user to upgrade the APP. If user choose yes , system will upgrade APP automatically.
UmsAgent. UMSApi.onPageBegin(string pagename); pagename: the page you want to gather statistics
Invoke this API in the OnNavigatedTo method of the page/form . This method records the time of user enters into this page.
UmsAgent. UMSApi.onPageEnd(string pagename); pagename: the page you want to gather statistics
Invoke this API in the OnNavigatedFrom method of the page . This method records the time of user leaves this page.
Note: You need to call 2 APIs above in pair.
Except basic data statistics analysis, the SDK also supports data statistics analysis of custom event. For example, you can count AD clicks or times of video has been played. Here we provide several simple and common interfaces:
UMSAgent.UMSApi.onEvent(string event_id,string pagename); pagename: the reference of current page
event_id: the ID of current event, defined on the Web Server and could not have spaces.
Invoke this API will send event info to the server and generate the event report on the server which analyzes sending times and changing trends corresponding to event_id, such as AD clicks, message numbers and so on.
For example, to monitor AD clicks of App in “MainPage”, the Event ID of which is “ ad_click“ defined on the Web Server, you need call UMSAgent.UMSApi.onEvent(“ad_click“, “MainPage”) in App , which will notify server that an AD click event has occurred.
UMSAgent.UMSApi.onEvent(string event_id, string pagename, string label); This API is an overloaded method of onEvent(string event_id,string pagename) which will monitor the proportion of specific label in event. The label is the devision name and event_id could not have spaces.
For example, a province has a corresponding event_id and one city of which has a corresponding label in App. Thus, we can observe the proportion of event corresponding to the city in generated data statistics reports.
UMSAgent.UMSApi.onEvent(string event_id, string pagename, int acc); For the frequent events ,you can maintain a counter for them. In this way, event that are triggered by many times will just generate one message and be sent to the server. This message includes triggered times of this event.
Here is overloaded two APIs:
UMSAgent.UMSApi.onEvent (string event_id, string pagename,int acc);
UMSAgent.UMSApi.onEvent (string event_id, string pagename, string label,int acc); acc: triggered times of corresponding event.
UMSAgent.UMSApi. bindUserIdentifier(string userid);
userid : user account. You can bind user’s account information to your app when you call this function.
Bind your user’s tag and send data to server.