App Intercepts: Implementation using WebView or WKWebView

The best method of implementing Ethnio inside an  iOS or Android app is simply to instantiate a browser layer using standard libraries that are most likely already part of your app. This way you can control what behavior triggers an ethnio screener and there are no external libraries in your app that could make mobile developers nervous. We also provide an endpoint you can query to populate that layer dynamically with content from Ethnio, and use targeting. More details below, and please note we use an example ID of 22910 throughout this article, which you would replace with the screener ID from your own intercept. That can be found on screeners > publish.

  • Step 1: Preview of app intercept what this looks like: ethn.io/preview/22910#app
    Gives you an idea what the experience of filling out a screener inside a webview layer in your app might be like.
     
  • Step 2: Check the Endpoint to query for on/off status and Targeting:  ethn.io/is_active/22910
    This lets you only display the app intercept based on targeting or on/off status, and optionally fill your own invite webview styles with dynamic Ethnio content. 

  • Step 3: Load the screener from the "App URL" in your webview layer = https://ethn.io/app/22910
    The "app" in the URL just means we format content to be friendly for the webview layer, including options like on/off buttons, which can be edited from screeners >> design >> app intercept.

Important Note about WKView

For iOS intercepts using Ethnio, you may need to use WKView. See this Apple note below and in this Apple iOS documentation on webview layers.

mceclip1.png

 

Basic Syntax

The main endpoint that you use to query whether or not a given intercept should display in your app is the  is_active endpoint. This is based on whether the intercept is on/off in Ethnio, and if you're passing external variables, if the custom targeting conditions are met for a given app user. 

Sample syntax is below for detecting whether screener is on/off and displaying invite text from Ethnio. This means your app intercept (webview layer) is checking with Ethnio to see if it should display or not: ethn.io/is_active/22910

Intercept is Off

If any given screener is off, Ethnio returns the following, which is your indication to not display the webview layer:

<span class="wysiwyg-color-black40">{"id":0}</span>

Intercept is On

If the screener is on, Ethnio returns an ID greater than 0, which tells your app to display the webview layer. Ethnio also returns the content for the invite step, including:

  • Title (Do you have a few minutes for research?)
  • Subtitle (Incentive field)
  • Body  
<span class="wysiwyg-color-black40">{"id":"5247","title":"Try the iOS or Android Library?","subtitle":"Place our code in your app","body":"If you're interested in using our iOS or Android library in your app to intercept potential recruits, we'd like to help. Just answer a few short questions, .and we'll email you with next steps."}</span>

Close Button Option

You can toggle a close button on/off to appear in the Ethnio intercept that appears inside your app from  screeners >> design >> app intercept. The complete details on how to make sure the close button works inside your iOS or Android app are here.

mceclip0.png

Targeting

In order to use custom targeting filters for app intercepts, you need to pass those variables via URL, and the same is_active endpoint from above will return {"id":0} if the right conditions are not met. 

For example, here's sample syntax for targeting based on two external variables so your app intercept will only display to certain app users:

ethn.io/is_active/22910?fruit_purchases=a&customer_type=2

Let's say that fruit_purchases=a is defined as "purchased an apple before" in Custom Targeting Filters (details here on how to do that), and customer_type=2 means it's a VIP customer. The researcher can then decide that this particular app intercept would only display for VIP customers who have purchased an apple before

If they need to change that, they just head to custom targeting filters and edit the conditions without having to use engineering resources. If the right conditions are not met, the is_active endpoint will return ("id":0}, thus telling your app not to display any intercept.

Please Keep in Mind

The invite step is required for targeting to work properly for app intercepts (and actually for web intercepts as well).

Only variables with defined parameters will work as targeting filters, so if you wanted to filter on a range of customer IDs, we don't quite support that yet. You can however store open-ended strings as a hidden question type, which is a slightly different use of variables than targeting. 

Also, with App Intercepts, the default targeting by device or region works more accurately if you pass that type of data via external variables as well.

Still need help? Contact Us Contact Us