Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

AngularJS & SPA support?

Anonymous
Not applicable

Do Omniture support AngularJS and SPA?

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

 

Srini

1 Accepted Solution
Ben_Bytheway
Correct answer by
Employee
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
Ben_Bytheway
Correct answer by
Employee
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