2

Only the last added plugin is working. Suppose I reverse the below angulartics plugin then only splunk works. Is there any way to capture data simultaneously for these two analytics providers?

app = angular.module('MyApp', [    
    'angulartics',   

    'angulartics.splunk',
    'angulartics.google.analytics'   

]);
PKS
  • 51
  • 1
  • 5

3 Answers3

1

I modify the angulartics.js to accept array and modify registerPageTrack and registerPageEvent. Sample modified registerPageTrack function. This is not the final code as i am working on it.

var registerPageTrack = function (fn, provider) {

    //api.pageTrack = fn;
    if (provider == 'splunk') {
        api[0].pageTrack = fn
    }
    else {
        api[1].pageTrack = fn
    }

    angular.forEach(api, function (p,i) {
        angular.forEach(cache.pageviews, function (path, index) {
            setTimeout( function () { 
                api[i].pageTrack(path); 
            }, index * settings.pageTracking.bufferFlushDelay);
        });
    });

    // angular.forEach(cache.pageviews, function (path, index) {
    //     setTimeout( function () { 
    //         api.pageTrack(path); 
    //     }, index * settings.pageTracking.bufferFlushDelay);
    // });
};
Matt Rowles
  • 7,721
  • 18
  • 55
  • 88
PKS
  • 51
  • 1
  • 5
1

Yes - since version 0.16.1. This was the PR.

Kunal
  • 490
  • 2
  • 9
  • 18
0

Just an update for anyone finding this question, the latest version (0.17.x at time of writing) now caters for multiple vendor sources, at the very least for GTM and GA in that order of precedence.

Matt Rowles
  • 7,721
  • 18
  • 55
  • 88