Created
May 22, 2015 10:16
-
-
Save garygreen/fa5b07550820e6643289 to your computer and use it in GitHub Desktop.
Detect if mouseflow recording and get original path
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(window) { | |
function MouseflowRecording(playback) { | |
this.playback = playback; | |
} | |
/** | |
* Get original path | |
* | |
* @return {string} | |
*/ | |
MouseflowRecording.prototype.getOriginalPath = function() { | |
var path = this.playback.pointer.baseURI.match(/http:\/\/[^\/]+(.*)/); | |
return path ? path[1] : ''; | |
}; | |
window.mouseflowRecording = (function() { | |
var playback = window.parent.playback; | |
if (playback) | |
{ | |
return new MouseflowRecording(playback); | |
} | |
})(); | |
})(window); | |
// Usage: | |
if (mouseflowRecording) | |
{ | |
console.log(mouseflowRecording.getOriginalPath()); // will return e.g. 'member/register' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment