Version: | 1.2.0 |
---|---|
Date: | 2014-06-05 |
Author: | Kantar Media spring |
eMail: |
All spring sensors capture the events in the moment in which they arise. This concept is also implemented in the libraries for the apps, that means that all actions are sent immediately.
In case of any questions concerning this, please contact our support team under support@spring.de.
Out of the application, an HTTP request has to be sent to the measuring system.
Variable | Mandatory | Description |
---|---|---|
ac | No | The action that has been executed. |
By using this variable, the measuring system can be informed, which actions have been executed in the application.
Currently, the following actions are understood:
Variable | Description |
---|---|
| The application has been started. |
| The application was brought to the foreground or has received the focus. |
| The application was brought into the background or does no longer have the focus. |
| The application has been stopped. |
By using the variable ac, the execution of a content page within an application can be measured also.
Permitted characters are:
Slash "/" is used as separator for hierarchy levels |
The assignment of content and construction of booking units is in the responsibility of the supplier/marketer.
Example for this variable are
The user can be informed at some point that the application monitors the user actions and transmits them to a measuring system. Furthermore, the user must be informed that he has the possibility to switch of the tracking in the application and can contradict this way. (see: Opt-Out)
For this purpose, you can include data privacy information in your language into an appropriate place of your app implementation:
....................................................................................................................................................................................................
....................................................................................................................................................................................................
Mobile App Sensor Measurement: |On/Off|
The application developer can give users the ability to stop the further tracking of the user actions. For this purpose the library offers the following methods:
/** * When the value <code>false</code> is specified, the sending of * requests to the measuring system is switched off. * This value is <code>true</code> by default. */ public void setTracking(boolean tracking) { } /** * Delivers the value <code>true</code> when the tracking * is activated otherwise the value is <code>false</code>. */ public boolean isTracking() { } |
A persistent saving of the opt-out decision in the library is not provided and needs to be implemented by the app developer.
Should you encounter any issues or problems during the implementation, please send an email to our support team under support@spring.de with the following information:
The following example shows the basic installation for the iOS platform. When generating the class SpringMobile
a site identifier (<site>) has to be indicated, which is shipped together with this documentation and the libraries.
At the application start the Spring object has to be instanced one-time and to be used for the whole life cycle of the application |
/* * Importing SpringMobile */ #import "Spring.h" /* * Providing entity */ Spring *spring; /* * Generating SpringMobile entity with site id and * application name */ spring = [[Spring alloc] initWithSiteAndApplication:@"<site>" application:@"myApplication1"]; /* * Sending the start of the application to the measurement system */ NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithObjectsAndKeys:APP_STARTED,VAR_ACTION,nil]; [spring commit:dict]; ... // OR /* * Sending the action spring.BACKGROUND */ NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithObjectsAndKeys:APP_BACKGROUND,VAR_ACTION,nil]; [spring commit:dict]; |
Example: Implementation of an app page request via the action variable (ac)
/* * Importing SpringMobile */ #import "Spring.h" /* * Providing entity */ Spring *spring; /* * Generating SpringMobile entity with site id and application name */ spring = [[Spring alloc] initWithSiteAndApplication:@"<site>" application:@"myApplication1"]; /* * Sending AC to the measurement system */ NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"Mainpage",@"ac",nil]; [spring commit:dict]; ... |
With this value, a timeout (in seconds) for each HTTP request can be configured within the library.
Example:
spring = [[Spring alloc] initWithSiteAndApplication:@"app" application:@"Test App"]; spring.timeout = 30.0; // in seconds |
If this value is set on YES
, the library provides debug outputs over the class NSLog
.
spring = [[Spring alloc] initWithSiteAndApplication:@"app" application:@"Test App"]; spring.debug = YES; |
Output example:
2011-11-25 13:42:52.878 TestApp3[73923:ff07] spring (1.0.3.1)> http://test.2cnt.net/j0=,,,;+,app=Test%20App+did=7ca359bc4c3c6a19;;;?lt=gvf6lykt 2011-11-25 13:42:52.927 TestApp3[73923:ff07] spring (1.0.3.1)> http status code: 200 - no error 2011-11-25 13:42:56.521 TestApp3[73923:1020b] spring (1.0.3.1)> http://test.2cnt.net/j0=,,,;+,app=Test%20App+did=7ca359bc4c3c6a19+ac=spring.BACKGROUND;;;?lt=gvf6m1e1 2011-11-25 13:42:56.559 TestApp3[73923:1020b] spring (1.0.3.1)> http status code: 200 - no error 2011-11-25 13:42:59.388 TestApp3[73923:10013] spring (1.0.3.1)> http://test.2cnt.net/j0=,,,;+,app=Test%20App+did=7ca359bc4c3c6a19+ac=spring.FOREGROUND;;;?lt=gvf6m3lo 2011-11-25 13:42:59.427 TestApp3[73923:10013] spring (1.0.3.1)> http status code: 200 - no error 2011-11-25 13:43:04.554 TestApp3[73923:11f0b] spring (1.0.3.1)> http://test.2cnt.net/j0=,,,;+,app=Test%20App+did=7ca359bc4c3c6a19+ac=spring.BACKGROUND;;;?lt=gvf6m7l5 |
The following example shows the basic installation for the Android platform. When generating the class SpringMobile
a site identifier (<site>) has to be indicated, which is shipped together with this documentation and the libraries.
Example:
/** * Importing SpringMobile */ import de.spring.mobile.SpringMobile; /** * Generating SpringMobile entity with site id and * application name */ SpringMobile spring = new SpringMobile("<site>", "Application Name", getApplicationContext()); /** * Sending the start of the application to the measurement system */ Map<String, Object> map = new HashMap<String, Object>(); map.put(SpringMobile.VAR_ACTION, SpringMobile.APP_STARTED); spring.commit(map); /* * Sending the action spring.BACKGROUND */ Map<String, Object> map = new HashMap<String, Object>(); map.put(SpringMobile.VAR_ACTION, SpringMobile.APP_BACKGROUND); spring.commit(map); |
Example: Implementation of an app page request via the action variable (ac)
/** * Example AC */ import de.spring.mobile.SpringMobile; /** * Generating SpringMobile entity with site id and application name */ SpringMobile spring = new SpringMobile("<site>", "Application Name", getApplicationContext()); /** * Sending AC to the measurement system */ Map<String, Object> map = new HashMap<String, Object>(); map.put("ac", "Mainpage"); spring.commit(map); |
The following settings need to be conducted in the file AndroidManifest.xml AndroidManifest.xml
:
<uses-permission android:name="android.permission.READ_PHONE_STATE"> </uses-permission> <uses-permission android:name="android.permission.INTERNET"> </uses-permission> |
The setting of the permission through the user is not mandatory, but highly recommended. If the permission Two aspects are crucial: There is a bug in the Android version 2.2, which only occurs in connection with certain providers, where for all affected devices the same Android ID will be delivered. For the study, this would mean that the user identification would become much more difficult. |
With this value, a timeout (in seconds) for each HTTP request can be configured within the library.
SpringMobile spring = new ("app","TestApp",getApplicationContext()); spring.setTimeout(30); // in seconds |
Since Android 3.0 network accesses are not allowed from the main thread anymore. Thus, the Spring.commit () method must be called in different thread.
class CommitTask extends AsyncTask<Map<String,Object>, Void, Void> { protected Void doInBackground(Map<String,Object>... params) { if(params.length != 1) throw new IllegalArgumentException("one parameter expected"); spring.commit(params[0]); return null; } } |
The following example shows the basic installation for the Blackberry platform. When generating the class SpringMobile
a site identifier (<site>) has to be indicated, which is shipped together with this documentation and the libraries.
/** * Importing SpringMobile */ import de.spring.mobile.SpringMobile; /** * Generating SpringMobile entity with site id and * application name */ SpringMobile spring = new SpringMobile("<site>", "myApplication1"); /** * Sending the start of the application to the measurement system */ Hashtable target = new Hashtable(); target.put(SpringMobile.VAR_ACTION, SpringMobile.APP_STARTED); try { // ... spring.commit(target); } catch (ParamNotSupportedException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } /** * Sending the action spring.BACKGROUND */ Hashtable target = new Hashtable(); target.put(SpringMobile.VAR_ACTION, SpringMobile.APP_BACKGROUND); try { spring.commit(target); } catch (ParamNotSupportedException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); }  |
/** * Alternative method * Sending the action spring.BACKGROUND with own * connection parameters */ Hashtable target = new Hashtable(); target.put(SpringMobile.VAR_ACTION, SpringMobile.APP_BACKGROUND); Hashtable bbprops = new Hashtable(); bbprops.put("deviceside", "true"); try { spring.commit(bbprops,target); } catch (ParamNotSupportedException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } |
Example: Implementation of an app page request via the action variable (ac)
/** * example AC */ Hashtable target = new Hashtable(); target.put("ac", "Mainpage"); try { // ... spring.commit(target); } catch (ParamNotSupportedException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } |
Although the library provides the possiblity of using connection parameters, it is highly recommended to use "spring.commit(Hashtable target)". While using connection parameters that are not supported a respective exception is thrown. |
The following example shows the basic installation for the Windows Phone 7 platform. When generating the class SpringMobile
a site identifier (<site>) has to be indicated, which is shipped together with this documentation and the libraries.
/* * Importing SpringMobile */ using spring_mobile_wp7; /* * Generating SpringMobile entity with site id and * application name */ SpringMobile spring = new SpringMobile("<site>", "myApplication1"); /* * Sending the start of the application to the measurement system */ Dictionary<String, String> target = new Dictionary<string, string>(); target.Add(SpringMobile.VAR_ACTION, SpringMobile.APP_STARTED); spring.commit(target); ... /* * Sending the action spring.BACKGROUND */ Dictionary<String, String> target = new Dictionary<string, string>(); target.Add(SpringMobile.VAR_ACTION, SpringMobile.APP_BACKGROUND); spring.commit(target); |
Example: Implementation of an app page request via the action variable (ac)
/* * Example AC */ using spring_mobile_wp7; /* * Generating SpringMobile entity with site id and application name */ SpringMobile spring = new SpringMobile("<site>", "myApplication1"); /* * Sending AC to the measurement system */ Dictionary<String, String> target = new Dictionary<string, string>(); target.Add("ac", "Mainpage"); spring.commit(target); ... /* |
For the measurement we need the device ID. Please set the right for reading the device ID into a config file (WMAppManifest.xml).
|