Integrating with Classic Google Analytics

Please note: We now support sending SessionID's into Universal Analytics also. 
Please see the following article: Importing SessionIDs into Universal Analytics.
Google announced that all GA properties were moved across to Universal Analytics (https://developers.google.com/analytics/devguides/collection/upgrade/) and as such we
no longer maintain our code snippet for Google Analytics you can however find the article below.

You can import sessions from SessionCam into your Google Analytics dashboard. Importing sessions into Google Analytics means you can view sessions based on existing Google Analytics segments (e.g. Goals, e-commerce activity, advertising clicks etc.).
Importing SessionIDs into Google Analytics and viewing playback requires 3 simple steps:

 

  • 1 Add additional code snippet

The snippet you require depends on the version of Google Analytics you’re using and must be placed after the main SessionCam and Google Analytics tags.

Async version:

<script type="text/javascript">

window.sessionIdCount = 0;
window.sessionIdSet = false;

function setSessionId()
{
_gaq.push(['_setCustomVar', 1, 'SessionCamSessionID', sessionCamRecorder.sessionId(), 2]);
_gaq.push(['_trackPageview']);
window.sessionIdSet = true;
}

setTimeout(function()
{
sessionCamCheck();
}, 5000);

function sessionCamCheck() {
if(window.sessionIdSet == false && window.sessionIdCount < 20)
{
window.sessionIdCount++;
if(typeof window.sessionCamRecorder != 'undefined') {
if(window.sessionCamRecorder.sessionId().length > 40) {
setSessionId();
} else { setTimeout('sessionCamCheck()', 250); }
}
else { setTimeout('sessionCamCheck()', 250); }
}
}
</script>

Traditional (ga.js) version:

<script type="text/javascript">

window.sessionIdCount = 0;
window.sessionIdSet = false;

function setSessionId()
{
pageTracker._setCustomVar(1, 'SessionCamSessionID', sessionCamRecorder.sessionId(), 2);
pageTracker._trackPageview();
window.sessionIdSet = true;
}

setTimeout(function()
{
sessionCamCheck();
}, 5000);

function sessionCamCheck() {
if(window.sessionIdSet == false && window.sessionIdCount < 20)
{
window.sessionIdCount++;
if(typeof window.sessionCamRecorder != 'undefined') {
if(window.sessionCamRecorder.sessionId().length > 40) {
setSessionId();
} else { setTimeout('sessionCamCheck()', 250); }
}
else { setTimeout('sessionCamCheck()', 250); }
}
}
</script>

Note: If you already use custom variables in Google Analytics you may need to use a different slot (slot 1 is used in the above code). More information is available at the Google Analytics code website.

 

  • 2 Accessing SessionID in Google Analytics dashboard
SessionIDs are imported as a custom variable, which are available when setting up a Custom report in Google Analytics.
 

To set up a new custom report go to "Customized reporting" and then click on "+ Create new report". Next select the Metrics and Dimensions relevant to the segment that you want to review. Then add "Custom Variable (Value 1)" as a sub dimension to any dimensions you've already added.

 

  • 3 Viewing reports and playback
Once you have created a Custom report, you can then drill down into your report to obtain a list of SessionIDs.
 
The SessionID will look something like this
f3f34551-7ba0-4f9a-a8ac-8683ea74a341,634821081340000000
 
To view a specific session in SessionCam, simply log into the SessionCam console and then paste the playback URL into your browser (https://console.sessioncam.com/Dashboard/Playback/?SessionId=xxxx) and replace "xxxx" in the URL with the SessionID you wish to play.
 
Alternatively you can now download our Chrome plugin as explained in the following article to quickly launch a session replay directly from the Google Analytics dashboard: Launching Playback of Recorded Sessions directly from Google Analytics or SiteCatalyst