boomerangJS for SPA with AngularJS

736 views Asked by At

I am trying to use boomerangJS for SPA built using AngularJS

using plugins: plugins/rt.js plugins/navtiming.js plugins/auto_xhr.js plugins/spa.js plugins/angular.js

with init

BOOMR.init({
    beacon_url: 'http://myValidDomaincom/test.gif',
    autorun: false,
    instrument_xhr: false
  });

Angular plugin is hooked using below code:

.run(['$rootScope', function($rootScope) {
var hadRouteChange = false;
$rootScope.$on("$routeChangeStart", function() {
    hadRouteChange = true;
});

function hookAngularBoomerang() {
    if (window.BOOMR && BOOMR.version) {
        if (BOOMR.plugins && BOOMR.plugins.Angular) {
            BOOMR.plugins.Angular.hook($rootScope, hadRouteChange);
        }
        return true;
    }
}

if (!hookAngularBoomerang()) {
    if (document.addEventListener) {
        document.addEventListener("onBoomerangLoaded", hookAngularBoomerang);
    } else if (document.attachEvent) {
        document.attachEvent("onpropertychange", function(e) {
            e = e || window.event;
            if (e && e.propertyName === "onBoomerangLoaded") {
                hookAngularBoomerang();
            }
        });
    }
}
}])

And when first time page is loaded I trigger BOOMR.page_ready(); using JS

Now when I go through the flow which loads different views, I don't see any new beacons getting triggered

  • What's the expected behavior?
  • Will boomerang trigger new beacons each time a new view is displayed on page ?
  • Am I missing any configuration or code, to get it working ?
0

There are 0 answers