Created
November 27, 2017 18:52
-
-
Save Nils-van-Kleef/5afb7e105cf6f3f3a23023611f099e45 to your computer and use it in GitHub Desktop.
Integration of Usabilla with Optimizely. Use in Custom Analytics Integrations
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
{ | |
"plugin_type": "analytics_integration", | |
"name": "Usabilla", | |
"form_schema": [], | |
"description": "", | |
"options": { | |
"track_layer_decision": "console.log('4');\n\nfunction userCustomData() {\n ub_window = (document.getElementById('lightningjs-frame-usabilla_live') || {}).contentWindow || {};\n return (ub_window.usabilla_live_settings || {}).local_data\n}\n\nfunction updateUsbl() {\n \n\t// capture Optimizely data\n\tvar campaignInfo = optimizely.get('state').getDecisionObject({'campaignId': campaignId});\n\n\t//retrieve current Usabilla custom variables\n var usbllocaldata = userCustomData();\n var usblCustomVars = usbllocaldata.custom;\n\n //add Optimizely data to custom variable object\n usblCustomVars['Optimizely_' + campaignInfo.experiment] = campaignInfo.variation;\n\n //send updated custom variable object to Usabilla\n window.usabilla_live('data', {\n \t'custom': usblCustomVars\n });\n}\n\n//initiate polling for Usabilla object\n\nvar count = 0;\nvar poll = setInterval(function(){\n count++;\n if (count >= 50){\n clearInterval(poll); \n }\n if (typeof window.usabilla_live !== 'undefined')\n {\n \twindow.usabilla_live('onLoad', updateUsbl);\n clearInterval(poll);\n }\n \n}, 25);" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment