Enabling and disabling Echo
By default Echo is enabled meaning that it will send http requests, or cache request data, when you notify it of an event such as a view, action or AV play. There are circumstances in which you may not want Echo to send http requests etc but do want to continue making calls to Echo. This can be achieved by disabling Echo during initialisation or on the fly.
When disabled Echo:
- will not make any http requets
- will not cache any event data
- will not track media or make any calls to your PlayerDelegate
- any BBCUser objects passsed to the EchoClient constructor or EchoClient.setBbcUser will be honoured
Table of contents
Setting properties while Echo is disabled
Any properties set while Echo is disabled should be honoured e.g.
- you initialise Echo in a disabled state
- you set your app version and player name
- you then enable Echo
- subsequent events will include your app version and player name information
Setting Media items while Echo is disabled
Any media items set while Echo is disabled will be ignored.
If you disable Echo in the middle of an AV session Echo will end the session automatically.
To start a new session you must re-enable Echo before you begin configuring the new media.
Code example
var config = {};
// start Echo in a disabled state
conf[ConfigKeys.ECHO_ENABLED] = false;
var echo = new EchoClient('MyApp', Enums.ApplicationType.WEB, config);
// event will not be sent
echo.viewEvent('home.page');
// enable Echo
echo.enable();
// event will be sent
echo.viewEvent('article.page');
// disable again
echo.disable();
// event will not be sent
echo.viewEvent('article.page');
HashMap<String, String> config = new HashMap<String, String>();
// disable Echo
config.put(EchoConfigKeys.ECHO_ENABLED, "false");
echo = new EchoClient(
"MyApp",
ApplicationType.MOBILE_APP,
"bbc.start.page",
getApplicationContext(),
config);
// event will not be sent
echo.viewEvent("home.page");
// enable Echo
// a start event will be sent to comscore
echo.enable();
// event will be sent
echo.viewEvent("article.page");
// disable Echo again
echo.disable();
// event will be sent
echo.viewEvent("article.page");
var config:Dictionary<EchoConfigKey, String>
// disable Echo
config[.echoEnabled] = "false"
do {
echo = try EchoClient(appName: "MyApp",
appType: .mobileApp,
startCounterName: "bbc.start.page",
config: config
} catch {
// Handle Echo config error
}
// event will not be sent
echo.viewEvent("home.page")
// enable Echo
// a start event will be sent to comscore
echo.enable()
// event will be sent
echo.viewEvent("article.page")
// disable Echo again
echo.disable()
// event will be sent
echo.viewEvent("article.page")
“Start” events
ATI does not send “start” events in the way Comscore did. The first event that will be sent by ATI is a view event, when it is triggered by your app.
You can still prevent Echo from starting when it is initialised, but there is probably no reason to do this anymore. Auto-start is enabled by default.