Last active
December 27, 2015 06:14
-
-
Save bwll/d9c5362e69a7a6b914c0 to your computer and use it in GitHub Desktop.
Firing in Optimizely page view goal in AngularJS
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
/* | |
Send an Optimizely page view tracking call in AngularJS | |
*/ | |
window.scope = window.angular.element(document).find('body').scope(); | |
window.scope.$on('$locationChangeSuccess', function(event, next, current) { | |
window['optimizely'] = window['optimizely'] || []; | |
window.optimizely.push(['trackEvent', next]); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment