Passing in Custom User Data
Kolahawk lets you pass in any custom data you'd like, and it will appear in the Live Visitors and Recording tabs as a new column automatically. Using a bit of JavaScript, you can pass custom data to your Lucky Orange recordings using the global _loq
variable:
<script>
window._loq = window._loq || []
window._loq.push(['custom', customData])
</script>
That variable you see above, customData
, should be an object with keys and values you want to associate with your recordings. For example, if your current visitor's name is John Doe, and John's email address is email@example.com, you could set customData
to equal this object:
var customData = {
'name' : 'John Doe',
'email' : 'email@example.com'
}
Note that in the example above, these are hard-coded strings, and will set every visitor's name and email to John Doe and email@example.com. You'll want to supply dynamic values here. Dynamic values can come from your database, from a 3rd party service, or probably most commonly, from a form being filled out on the page. How and where custom data appears will be specific to each website where Lucky Orange is installed.
So if, for example, we have the variables name
and email
that contain our visitor's data, we can associate those values with the current recording by using the following script:
<script>
var customData = {
'name' : name,
'email' : email
}
window._loq = window._loq || []
window._loq.push(['custom', customData])
</script>
You don't have to pass in email or name, but if you do we will treat those specially and even try to find a Gravatar associated with the email, so you can see the visitor's public profile picture directly in your dashboard.
Note that you can send any key and value you wish to in the <code>customData</code> object, for example, <code>{ 'whatever1': true }</code>. Then a new column will show in the visitor and recordings tab called whatever1
. You can add as many as you want and call them whatever you want, and they will automatically show up in the dashboard as the data becomes available.