Setting a Custom Variable based on a QueryString value

Custom Variables are the mechanism for pushing data from your website/system into SessionCam.  You can push as many data items as you wish, and then within the SessionCam console, you can search for any sessions containing the specific data (for example a reference number).  

You can also import query string data into SessionCam by using custom variables. This can be highly valuable as it means you can segment traffic by query string data (such as marketing tracking codes).

The example below is a modified version of the default custom variable code. It imports the value of "s=" in the query string (if found) and it is then available to select as a custom variable.

If a user went to "", "source" would have the value of "xyz". You can tweak this code to specify relevant query strings and send accordingly.

<script type="text/javascript">
function getQueryString(key)
var value = "";
var url = window.location.href.toLowerCase();
var start = url.indexOf(key.toLowerCase() + "=");
if (start > -1)
var temp = url.substring(start + key.length + 1);
var end = temp.indexOf("&");
if (end < 0) end = temp.indexOf("#");
if (end < 0)
value = temp;
value = temp.substring(0, end);
return value;
var QueryString = getQueryString('s');
if(QueryString !=""){
if(!window.sessioncamConfiguration) window.sessioncamConfiguration = new Object();
window.sessioncamConfiguration.customDataObjects = [];
window.sessioncamConfiguration.customDataObjects.push({ key: "source", value: QueryString });
} </script>