Expand my Community achievements bar.

SOLVED

AngularJS & SPA support?

Avatar

Former Community Member

Do Omniture support AngularJS and SPA?

I already have omniture, need some help to implement in Angular.

 

Srini

1 Accepted Solution

Avatar

Correct answer by
Employee

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.  :)

View solution in original post

1 Reply

Avatar

Correct answer by
Employee

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.  :)