-
-
Save LMG23/271cb6005c9db8db66dd43a417a6257e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| window.usabilla_live("setEventCallback", function(category, action, label, value) { | |
| if(action != "Campaign:Open") { | |
| return; | |
| } | |
| window.addEventListener("message", function(event) { | |
| // Listen to messages from the Usabilla Cloudfront domain | |
| if(!/d6tizftlrpuof\.cloudfront\.net/.test(event.origin)) { | |
| return; | |
| } | |
| try { | |
| var data = JSON.parse(event.data); | |
| // On the final page | |
| if(data.type === "pageSwitch" && data.end) { | |
| for(var key in data.data) { | |
| ga('gtag_trackerName' + '.send', 'event', | |
| 'GetFeedback Web Campaign - ' + label, // event category | |
| key, // event action | |
| data.data[key] // event label | |
| ); | |
| } | |
| } | |
| } catch(e) { | |
| // Ignore errors, usually JSON decode problems | |
| } | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment