Alternative solution for pseudonymous hybrid measurement.¶
This document describes a special form of hybrid app measurement integration in environments where the use of native SZM libraries (pseudonymous measurement) cannot be used universally. The document exclusively describes the specifications of the alternative solution of integrating the measurement of hybrid apps across platforms.
For all further information, please refer to the content in the "Hybrid Measurement" section.
Valid for MEWs and stationary websites.¶
Hybrid apps usually obtain external web content from websites that are optimized for mobile device use. These websites are referred to as MEW (=mobile enabled website) in this document. If your hybrid app draws content from a stationary website (optimized for use by PCs and notebooks), all conditions described in the document for MEWs apply equally to the stationary website.
Measurement of hybrid apps (standard solution)¶
The library for pseudonymous measurement (INFOnline Measurement pseudonym) is able to measure the usage of hybrid apps, i.e. user actions within mobile content, which are presented in so-called 'WebViews', can also be captured and merged with the measurement data of the native app framework.
The prerequisite for merging the usage measurement from the app frame and MEW is that the websites accessed via the WebView
are also tagged with the pseudonymous web sensor (formerly SZM tag) for mobile-enabled websites. The app and the MEWs called up from the app must use different site IDs assigned by INFOnline. Another requirement is that the call to the 'WebView' from the app code is adapted and called via the 'IOLWebView class' in order to provide the 'app identifiers' (currently mainly Client ID and site ID of the app) in the 'WebView'. The platform-specific Integration Guides describe how to implement usage measurement of hybrid apps using the native pseudonymous libraries throughout (default solution).
Alternative solution for the measurement of hybrid apps.¶
In addition to native app programming, other options are available in practice to develop an app. For example, development frameworks such as PhoneGap or Titanium support cross-platform development with a high proportion of web content. At the same time, these platforms limit the influence possibilities in the area of native app code by, for example, prohibiting the customization of the WebView call
. As a result, hybrid measurement according to the standard procedure using the pseudonymous libraries is not fully possible. INFOnline describes in the following document how the measurement of hybrid apps can be implemented without using the customized WebView call (IOLWebView
) provided by the pseudonymous library (alternative solution).
Integration alternative solution¶
Differences integration standard / alternative solution¶
The alternative solution of integrating the measurement of hybrid apps is based on the described procedure, where
- the
App identifiers
are transferred from the app frame to the `WebView - and there transmitted to the pseudonymous system when the
MEW tag
is called.
This makes it possible to merge the user actions in the app frame with those of the MEW usage into one usage transaction.
Compared to the standard solution, the alternative solution for integration differs in one point:
- the transfer of the 'app identifiers' from the app frame to the 'WebView' is done manually (standard solution: is done automatically by calling the 'IOLWebView')
Prerequisites¶
For the measurement of hybrid app usage using the alternative method, the following prerequisites must be met:
- the platform-specific pseudonymous library (version 2.0 or higher) must be integrated into the app frame and initialized when the app is started.
- the content accessed in the 'WebView' must be tagged with the version of the pseudonymous web sensor (formerly SZM tag) for mobile-enabled websites (MEW) that supports hybrid measurement
- the parameters must be passed between the app frame and the 'WebView' being used
The use of the pseudonymous library (from version 2.0) in the app frame is mandatory, since
- classification features of the app are formed via the pseudonymous library and transmitted to the pseudonymous system for classification of the usage process
- the library transmits automatic start-stop events of the app that are relevant for the interpretation of the usage process
- the app identification features are formed according to the specifications of the pseudonymous measurement and provided for further use
Technical integration¶
Pseudonyms library¶
The platform-specific pseudonymous library must be implemented according to the specifications of the associated Integration Guide. The library must be initialized when the app is started. At least version 2.0 of the pseudonym library must be used.
Determining the app identifiers¶
To determine the app identifiers, the pseudonymous library provides a dedicated getter function that can be called from the app's page code. The result is a JSON string to be stored in a suitable string variable and used when calling the setMultiIdentifier method
. The result of getMultiIdentifier()
is a JSON object as a string whose quotes are escaped. Examples for calling the method: iOS: As of the pseudonymous library version 2.0, the class IOLWebView
exists in two variants, which are to be considered identical with respect to the result: recommended: [IOLWKWebView multiIdentifierString]
; alternatively:
[IOLUIWebView multiIdentifierString]
; Recommended is the use of IOLWKWebView
(which references the SDK base class WKWebView
), since as of iOS 12 the SDK base class UIWebView
(which underlies IOLUIWebView) is marked as deprecated and will thus be dropped in the future. Note The SFSafariViewController
cannot be used for pseudonymous measurement as it does not provide JavaScript injection capabilities!
Pseudonymous measurement:
IOLSession.getSessionForType(IOLSessionType.SZM).requestMultiIdentifier
(IOLSession.MultiIdentifierCallback multiIdentifierCallback);
The MultiIdentifierCallback is an interface that returns the "MultiIdentifier" via the onMultiIdentifier(String identifier)
method once it is available. According to Google guidelines, the collection of the AdvertisingIdentifier must be done asynchronously. On Android, you also have to make sure that JavaScript and DOM storage are enabled, which is not necessarily the case in a standard WebView
:
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setDomStorageEnabled(true);
Note It is important to make sure that a session of the respective pseudonymous library has been initialized before calling these methods!
Passing the app identifiers into the WebView
usage
For transferring the app identifiers from the app frame to WebView
usage INFOnline provides the JavaScript function
iom.setMultiIdentifier(identifier:string)
is provided. identifier:string
denotes the string variable into which the result of the function call was stored. This function must be called each time a URL is called in the WebView.
Setup web pages to capture hybrid usage.¶
The web pages that are called up in the usage process of the hybrid app with the 'WebView' and whose usage is to be recorded must be tagged as described in the chapter "Special pseudonymous web sensor when participating in app measurement".