Accepted Solutions (1)

Accepted Solutions (1)

Ben_Bytheway

Employee

15-10-2015

Hey Srini,

I know this is old, but I wanted to come back and answer this from an answer I gave a little bit ago.  Yes, you can track SPA's.  Here is what I posted before:

I don't have any documentation or best practices, but we have done a little bit of tracking with angular and this has come in handy for "page views":

http://michalostruszka.pl/blog/2013/09/24/angularjs-in-browsers-console/

In other words, if you want to hook into a view change event with angular, you could do something like this:

$('appElement').scope().$root.$on('$locationChangeSuccess', function () { console.log(window.location.href); // can use this for page name //s.t(); or s.tl(...); or fire a "direct rule" in DTM });

There are other things you can do from there of course like listening/watching:

https://docs.angularjs.org/api/ng/type/$rootScope.Scope#$watch

And you can use DTM's selectors to do other event based rules as well.

That is the little advice I can give.  🙂

Answers (0)