Testing your applications
There are a few configuration tweaks that you should apply when you wish to test your Echo app. Following testing, you can remove these tweaks in order to revert to Echo’s default config for tracking a live piece of media.
Table of contents
Debug Mode
By default Echo silently ignores errors arising from bad configuration. In non-live environments, you should enable debug mode, which will print any errors to the console. You can set the debug level according to the desired verbosity, “info” (all log outputs), “warn”, or “error” (only errors), or false to disable logging:
// Enable Debug mode (for testing)
config[ConfigKeys.DEBUG_MODE] = "error"
// Enable Debug mode (for testing)
config.put(ConfigKeys.ECHO_DEBUG, "error");
// Enable Debug mode (for testing)
config[.echoDebug] = "error"
Debug values of “true” (or “1” on Android) are supported for backwards compatibility, and are equivilent to “warn”.
For Android, you can configure EchoDebug to throw exceptions by providing the config key ConfigKeys.THROW_ON_ERROR
as “true”:
// Throw exceptions from Echo
config.put(EchoConfigKeys.THROW_ON_ERROR, "true");
Understanding ATI requests
There is a Confluence page here detailing all the parameters that are sent to ATI and what they mean. If you have any queries that are not covered by that then get in touch with the Analytics Services team.
Echo Chamber
Echo Chamber is a a dummy endpoint for testing products which have had Echo integrated into them, without needing to use DAx. It allows you to retrieve the events that are sent out of Echo via a web gui or a RESTful API (API Docs can be viewed, assuming you are running Echo Chamber), which could be used for automated testing.
Echo Chamber can be run locally using Docker. See the project readme for details on how to set this up. You can also email the Analytics Services Team D-list, or ask questions in the #help-echo slack channel.
Echo Chamber is designed to capture analytics traffic produced by an application and make that traffic available for human and programmatic inspection. This enables:
- Developers and testers to be able to view the analytics data produced by a product in real time as they navigate and use the product.
- Test scripts to be written which exercise the product and then assert that the expected analytics data was produced.
Echo Chamber is useful for testing but ultimately is not a substitute for testing in DAx. There is no easy way to verify that a sequence of events sent to Echo Chamber would result in the expected report if sent to DAx.
Echo Trace
If you want to use EchoChamber for testing, you should set a unique “Echo Trace” value (via the config, see advanced config for details) for each session, so that you can identify the events you send in.
Capturing Comscore Events
To configure your Echo Client to send comscore events to Echo Chamber, configure your EchoClient as below.
var conf = { };
conf[ConfigKeys.TEST_SERVICE_ENABLED] = true;
conf[ConfigKeys.TEST_SERVICE_URL] = 'http://localhost';
HashMap<String, String> config = new HashMap<String, String>();
config.put(EchoConfigKeys.TEST_SERVICE_ENABLED, "true");
config.put(EchoConfigKeys.TEST_SERVICE_URL, "http://localhost");
var config:Dictionary<EchoConfigKey, String>
config[.testServiceEnabled] = "true"
config[.testServiceURL] = "http://localhost"
Capturing BARB Events
The BARB delegate sends events to a specific subdomain of the site 2cnt.net
. If you’d like to test a BARB implementation, you should modify your machine’s hosts file (/etc/hosts
on a mac) to route all requests from 2cnt.net
to 127.0.0.1
. If you are behind a proxy, then you should also ensure that all proxy settings are bypassed for requests to *.2cnt.net
. It is also possible to modify the target subdomain using the config parameter 'BARB_SITE_CODE'
.
The following labels are expected when reporting to BARB:
Label | Example Value | Description |
---|---|---|
cq | p1234 | Content ID (generally a version PID or service PID) |
uid | 16bbfa2 | Random unique ID per tracking session |
pst | ,,0+25+o4hgsc | Position data (see below) |
dur | 60 | Duration in seconds |
vt | 20 | Total tracking time |
An example of a player reporting on-demand media to BARB; that triggers a “Play” event and waits for 15 seconds will send the following requests:
note * pause events will result in additional pst “pairs”
http://bbcdotcomtest.2cnt.net/j0=,,,pl=valid-player-name+plv=player_version_1;+,trace=ugn6egm7tc+cq=versionid+stream=od+uid=49ya6jr+pst=,,0+1+obfhne;;+dur=0+vt=2;;;?lt=irhiaauy&c=000057a44b3ef14f0000
http://bbcdotcomtest.2cnt.net/j0=,,,pl=valid-player-name+plv=player_version_1;+,trace=ugn6egm7tc+cq=versionid+stream=od+uid=49ya6jr+pst=,,0+5+obfhne;;+dur=0+vt=6;;;?lt=irhiady1&c=000057a44b3ef14f0000
http://bbcdotcomtest.2cnt.net/j0=,,,pl=valid-player-name+plv=player_version_1;+,trace=ugn6egm7tc+cq=versionid+stream=od+uid=49ya6jr+pst=,,0+13+obfhne;;+dur=0+vt=14;;;?lt=irhiak4d&c=000057a44b3ef14f0000
http://bbcdotcomtest.2cnt.net/j0=,,,pl=valid-player-name+plv=player_version_1;+,trace=ugn6egm7tc+cq=versionid+stream=od+uid=49ya6jr+pst=,,0+14+obfhne;;+dur=0+vt=15;;;?lt=irhiakwm&c=000057a44b3ef14f0000
Converting the url requests into a table we can see that the PST and VT values increase as the media is playing :
URL Request Number | Trace ID | UID | PST Value | VT Value |
---|---|---|---|---|
1 | ugn6egm7tc+cq | 49ya6jr | ,,0+1+obfhne | 2 |
2 | ugn6egm7tc+cq | 49ya6jr | ,,0+5+obfhne | 6 |
3 | ugn6egm7tc+cq | 49ya6jr | ,,0+13+obfhne | 14 |
4 | ugn6egm7tc+cq | 49ya6jr | ,,0+14+obfhne | 15 |
When reporting live media the pst values will look slightly different (i.e. timestamps):
URL Request Number | PST Value |
---|---|
1 | ,,0+0+obfjy2;+,1470389689+1470389690+obfjy3 |
2 | ,,0+0+obfjy2;+,1470389689+1470389694+obfjy3 |
3 | ,,0+0+obfjy2;+,1470389689+1470389702+obfjy3 |
4 | ,,0+0+obfjy2;+,1470389689+1470389703+obfjy3 |
Differences when reporting on-demand vs live media
There are minor differences when reporting on-demand versus live media content as outlined below:
On-Demand | Live | |
---|---|---|
Content Id | Version Id | Service Id (If version Id eg ‘webcast’ then we enrich to service via ESS.) |
PST Value | position in seconds from player delegate | timestamp in seconds from player delegate |
Normalised events
The different analytics libraries that Echo Client includes transmit their data in different formats but typically all use the concept of sending client side events. Echo Chamber normalises the data it receives and creates a javascript document for each of these events. Where a single HTTP request contains multiple events (for example the flushing of cached events), these will be de-batched and a single javascript object created for each event.
The normalised events contain information about the HTTP request that carried them (timestamp, source IP, user-agent etc) and the data from the event itself, typically a set of key value pairs.
Viewing events
The value of the trace key included in the config parameter passed to the Echo Client can be used to view events.