Created
January 4, 2018 01:18
-
-
Save fIa5h/05446cd730c96892684e2f33a2755f9a to your computer and use it in GitHub Desktop.
Custom instrumentation to record strict, direct funnels within New Relic Insights
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
//instantiate globally | |
//below is the global array where we'll record the last 6 steps | |
window.NewRelicDirectFunnelArray = ["", "", "", "", "", ""]; | |
//and the function we'll use to manage the data structure | |
window.NewRelicDirectFunnelFunction = function(pageActionName){ | |
//capture a delimited string containing the last 6 pageActions since the initial pageload | |
var previousSixPageActionsString = window.NewRelicDirectFunnelArray.join("||"); | |
//dequeue the oldest pageAction value out of the queue | |
window.NewRelicDirectFunnelArray.shift(); | |
//push the newest pageAction value into the queue | |
window.NewRelicDirectFunnelArray.push(pageActionName); | |
//return the delimited pageAction path value | |
return { "previousPageActionPath" : previousSixPageActionsString }; | |
}; | |
// | |
// | |
//then, you may instantiate within your code similar to this | |
/* | |
newrelic.addPageAction( pageActionName , window.NewRelicDirectFunnelFunction(pageActionName) ); | |
*/ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment