Mouseflow Help & Support

Usabilla Integration

Follow

With Mouseflow, it's easy to integrate with other tools like Usabilla. You can send the link to play back a specific session directly to Usabilla via their JavaScript API. This allows you to see a user's response(s) in Usabilla and then play their actual session to see its surrounding context.

This integration makes use of some extra JavaScript. Just replace your tracking code with the snippet below.

Example:

<script type="text/javascript">

        var Cookie = {
	   set: function(name, value, days)
	   {
	      var domain, domainParts, date, expires, host;

	      if (days)
	      {
	         date = new Date();
	         date.setTime(date.getTime()+(days*24*60*60*1000));
	         expires = "; expires="+date.toGMTString();
	      }
	      else
	      {
	         expires = "";
	      }

	      host = location.host;
	      if (host.split('.').length === 1)
	      {
	         document.cookie = name+"="+value+expires+"; path=/";
	      }
	      else
	      {
	         domainParts = host.split('.');
	         domainParts.shift();
	         domain = '.'+domainParts.join('.');

	         document.cookie = name+"="+value+expires+"; path=/; domain="+domain;

	         if (Cookie.get(name) == null || Cookie.get(name) != value)
	         {
	            domain = '.'+host;
	            document.cookie = name+"="+value+expires+"; path=/; domain="+domain;
	         }
	      }
	   },

	   get: function(name)
	   {
	      var nameEQ = name + "=";
	      var ca = document.cookie.split(';');
	      for (var i=0; i < ca.length; i++)
	      {
	         var c = ca[i];
	         while (c.charAt(0)==' ')
	         {
	            c = c.substring(1,c.length);
	         }

	         if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	      }
	      return null;
	   },

	   erase: function(name)
	   {
	      Cookie.set(name, '', -1);
	   }
	};


// mouseflow tracking code

 window._mfq = window._mfq || [];
 (function() {
 var mf = document.createElement("script"); mf.type = "text/javascript"; mf.async = true;
 mf.src = "//cdn.mouseflow.com/projects/your-website-id.js";
 document.getElementsByTagName("head")[0].appendChild(mf);
 })();

 // usabilla integration code

if(typeof usabilla_live == "function" && typeof mouseflow == "object") {
window.usabilla_live('data', {
'custom':{'mouseflow_link': 'https://app.mouseflow.com/websites/' + mouseflow.websiteId + '/recordings/' + mouseflow.getSessionId() + '/play'} } );
} </script>

 

Tags: usabilla

Have more questions? Submit a request

Comments

Powered by Zendesk