The Acoustic Analytics Developer Hub

Welcome to the Acoustic Analytics developer hub. You'll find comprehensive guides and documentation to help you start working with Acoustic Analytics as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

On premise Server-side KillSwitch sampling functions for iOS

br.rx1 {margin-top: -1em;}

When the KillSwitch feature is enabled in the client configuration, the Framework queries the KillSwitch URL to determine whether to enable or disable the framework for that session. The KillSwitch URL can be .aspx, .jsp, or .php. To initialize your installation, go to to obtain your KillSwitch URL.

If the iOS logging framework is disabled, then the session is not captured and is excluded from the sampled data.

In the samples below, the KillSwitch URL returns 1 to enable the Framework and 0 to disable the iOS SDK. Each KillSwitch URL has a corresponding web.config configuration file.

Sampling functions

Sampling function for ASPX

These examples show the killswitch.aspx and web.config configuration file for ASPX

Example killswitch.aspx:

<%@ Page Language="C#" AutoEventWireup="true"%>
<script runat="server">
  public int Sampler()
    Random rand = new Random();
    int nextRandom = rand.Next(1,100);
    int samplepercent = Convert.ToInt32(ConfigurationManager.AppSettings["rate"]);
    if(nextRandom <= samplepercent){
        return 1;
        return 0;

    if (ConfigurationManager.AppSettings["killswitchtype"].Equals("percentagesample")) {
    <%= Sampler() %>
<% } else{ } %>

Example web.config configuration file for ASPX:

<?xml version="1.0"?>

  For more information on how to configure your ASP.NET application, 
  please visit

    <add key="killswitchtype" value="percentagesample"/>
    <add key="rate" value="50"/>

Sampling function for JSP

These examples show the killswitch.jsp and web.config configuration file for JSP.

For the JSP, if the:

  • request does not have parameters, then the client framework is always disabled.
  • id request parameter exists, it is used to check the whitelist.
  • randomsample parameter exists, the percentage rate from the file is used to determine how the server responds.

Debug Logs generate if the debug property is set to true.

Example killswitch.jsp:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
<%@page import="java.util.Properties"%>
<%@page import="java.util.Date" %>
<%@ page import="*"%>
<%@ page import="*" errorPage=""%>
    InputStream stream = application
    Properties props = new Properties();
    Boolean DEBUG = false;

    DEBUG = ("true").equals(props.getProperty("debug"));
    String id = request.getParameter("id");
    String randomsample = request.getParameter("randomsample");
    String killSwitchResponse = "";
    String debugstr = "";

    // white list
    if (id != null && !id.isEmpty()) {
        InputStream whitestream = application.getResourceAsStream(props
        BufferedReader input = new BufferedReader(
                new InputStreamReader(whitestream));
        String line = "";
        Boolean match = false;
        while ((line = input.readLine()) != null) {
            line = line.trim();
            if (line.equals(id)) {
                killSwitchResponse = "1";
                match = true;
        if (!match) {
            killSwitchResponse = "0";

    // If kill switch is by sample rate
    else if (randomsample != null) {
        int rand = (int) (Math.random() * 100);
        int sampleRate = Integer.parseInt(props
        if (rand <= sampleRate) {
            killSwitchResponse = "1";
        } else {
            killSwitchResponse = "0";
    } else {
        killSwitchResponse = "0";


    //always give the path from root. This way it almost always works.
    String nameOfTextFile = props.getProperty("logfile");
    PrintWriter pw;

    if (DEBUG) {
        try {
            pw = new PrintWriter(new FileOutputStream(nameOfTextFile,
            Date date = new java.util.Date();
            debugstr = date.toString() + "\t";
            if (request.getQueryString() != null) {
                debugstr += request.getQueryString();
                pw.println(debugstr + "\tDisable");
                pw.println(debugstr + "\tEnable");
            //clean up
        } catch (IOException e) {

Example web.config configuration file:

samplerate =50

Sampling function for PHP

These examples show the killswitch.php and web.config configuration file for PHP.

Example killswitch.php:

    $ini_array = parse_ini_file("config.ini", true);

    // if sample by percent
    if($ini_array['configtype']['killswitchtype'] === 'percentagesample'){
        $sampleRate = intval($ini_array['percentagesample']['rate']);
    // if sample by whitelist
    else {


    function killbysamplerate($sampleRate){
        $randomnumber = rand(1,100);
        if($randomnumber <= $sampleRate){
            echo '1';
        else {
            echo '0';

    function killbywhitelist($whitelistpath){


Example web.config configuration file:

; This is a sample configuration file
; Comments start with ';', as in php.ini


rate = 50


Updated 5 months ago

On premise Server-side KillSwitch sampling functions for iOS

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.