View ga-usabilla-integratie.js
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
window.usabilla_live("setEventCallback", function(category, action, label, value){ | |
function sendEvent(usblCategory, action, label, value){ | |
var trackers = ga.getAll(); | |
for(var i = 0; i < trackers.length; i++){ | |
var trackerName = trackers[i].get('name'); | |
ga(trackerName + '.send', 'event', usblCategory, action, label, value); | |
} | |
} | |
if(category === "feedback"){ | |
sendEvent("Usabilla Feedback", action, label, value); |
View usbl-virtpageview-react.js
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
Router.run(routes, Router.HistoryLocation, function (Handler) { | |
React.render(<Handler/>, document.body); | |
// your code here | |
window.usabilla_live('virtualPageView'); | |
}); |
View usbl-virtpageview-vuejs.js
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
import router from './router'; | |
router.afterEach((to, from) => { | |
// do your stuff | |
window.usabilla_live('virtualPageView'); | |
}); | |
new Vue({ | |
el: '#app', | |
router, | |
template: '<App/>', | |
components: { App } |
View usbl-virtpageview-angular.js
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
import { Router, NavigationStart, Event as NavigationEvent } from '@angular/router'; | |
constructor(router:Router) { | |
router.events.forEach((event: NavigationEvent) => { | |
if(event instanceof NavigationEnd) { | |
// do your stuff | |
window.usabilla_live('virtualPageView'); | |
} | |
}); | |
} |
View usbl-virtpageview-vanillajs.js
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
window.history.pushState('page2', 'Page 2 Title', '/page2.html'); | |
window.usabilla_live('virtualPageView'); |
View gist:a8bf81a1482bc938a810d96adde863c2
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
test |
View usabillaExample.js
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
<script type="text/javascript"> | |
var buttons = {'button1': "4937d621b6d2", 'button2': "e1bcdbe76eda"}; | |
var usabillaUrl = "//w.usabilla.com/" + buttons.button1 + ".js"; | |
/*{literal}<![CDATA[*/window.lightningjs||function(c){function g(b,d){d&&(d+=(/\?/.test(d)?"&":"?")+"lv=1");c[b]||function(){var i=window,h=document,j=b,g=h.location.protocol,l="load",k=0;(function(){function b(){a.P(l);a.w=1;c[j]("_load")}c[j]=function(){function m(){m.id=e;return c[j].apply(m,arguments)}var b,e=++k;b=this&&this!=i?this.id||0:0;(a.s=a.s||[]).push([e,b,arguments]);m.then=function(b,c,h){var d=a.fh[e]=a.fh[e]||[],j=a.eh[e]=a.eh[e]||[],f=a.ph[e]=a.ph[e]||[];b&&d.push(b);c&&j.push(c);h&&f.push(h);return m};return m};var a=c[j]._={};a.fh={};a.eh={};a.ph={};a.l=d?d.replace(/^\/\//,(g=="https:"?g:"http:")+"//"):d;a.p={0:+new Date};a.P=function(b){a.p[b]=new Date-a.p[0]};a.w&&b();i.addEventListener?i.addEventListener(l,b,!1):i.attachEvent("on"+l,b);var q=function(){function b(){return["<head></head><",c,' onload="var d=',n,";d.g |