Implementation Guide for Web Intercepts with Javascript Details
Quick Start
Ethnio is similar to a survey in functionality, but built exclusively for researchers. The basic functionality is that you can create a web-based form with custom questions, place JavaScript on your web site, and then control the display of that form from inside of ethnio. We call these things screeners. You can either use the JavaScript under Screeners >> Publish in your ethnio account, or a direct link if you don’t want to place third party JavaScript on your site.
Tag Managers
If you're using a tag manager, such as Google Tag Manager, check out the article here.
Options
Check out all publish options here.
JavaScript code segments
<script type="text/javascript" language="javascript" src="//ethn.io/xxxxx.js" async="true" charset="utf-8"></script>
- <!-- Ethnio Activation Code--> - Just a comment explaining that the code below is the Activation Code. Doesn't actually do anything to your page.
- type="text/javascript" - This tells the server what kind of code this is. In this case, it is Javascript.
- language="javascript" - Another way of telling the server that this is Javascript, but is recognized by older browsers. We use them both to make sure that everyone sees the Ethnio code properly.
- src="//ethn.io/xxxxx" - the // allows you to place it on a SSL or regular HTTP page without changing the code. It cleverly assigns HTTPS or HTTP dynamically.
- async="true" - This just tells the browser to load everything else before it loads the Ethnio code.
Architecture
In terms of the overall system, here’s a detailed explanation of the main methods inside Ethnio:
- Ethnio.should_display - Returns true or false. Checks several option before make decision
show or not screener. - Ethnio.get_cookie - Returns cookie stored by ethnio code
- Ethnio.set_cookie - Set cookie for certain user to know that screener already displayed.
- Ethnio.currently_displayed - Returns true if screener is showing right now
- Ethnio.wheel_of_fortune - Magic function which implements 'Display Interval’
- Ethnio.show - Main point of code for displaying screener / first page of screener
- Ethnio.insertIframe - Prepare iframe for rendering second and third steps of screener