Setting Up Custom Page Names/Paths based on a QueryString value

You can set your a custom page name and path on SessionCam based on a query string shown in the original page url. This can be be really useful, for example, if you wish to segment traffic by query string data (such as marketing tracking codes).

The example below is a modified version of the default custom pagename/path code. It grabs the value of "s=" in the query string (if found) and it is then set as the Custom Pagename or Path.

Using the example below if a user went to "www.domain.com/home.htm?s=xyz", "s" would have the value of "xyz" so the URL seen by SessionCam would be "www.domain.com/thepagepath/xyz". You can tweak this code to specify relevant query strings and set the page name/path 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;
else
value = temp.substring(0, end);
}
return value;
}
//Modify the parameter below to use the QueryString you need. For example your QueryString may be id=1234 then you would need to use id instead of s
var PageName = getQueryString('s');
if(PageName!=""){
if(!window.sessioncamConfiguration)
window.sessioncamConfiguration = new Object();
//Modify the line below to set the path as required, you can use '' to send a blank string
sessioncamConfiguration.SessionCamPath = "thepagepath";
sessioncamConfiguration.SessionCamPageName = PageName;
}
</script>

 

This script must be executed before the main SessionCam tag.