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

What's the best way to capture content changing under an ajax/angular framework?

Avatar

Avatar
Validate 1
Level 3
jeromerichard
Level 3

Likes

31 likes

Total Posts

28 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile

Avatar
Validate 1
Level 3
jeromerichard
Level 3

Likes

31 likes

Total Posts

28 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile
jeromerichard
Level 3

15-10-2015

Hi guys,

I'm working across a site under an angular/ajax framework, and I'm wondering what the best practice is for dealing with this kind of site. In the past under straight s_code I've asked the dev team to populate contextData/custom variables and execute an s.t() with clearVars if needed each time the content loads, triggering a virtual page load. I'd then in my s_code have a bunch of rules and switch statements to set the appropriate props/eVars/events.

Now using DTM, I can see how I could ask for a new js 'analytics' object that captures data like analytics.page and analytics.tool within data elements, however I'm unsure of how to trigger this capture on a location change within the ajax site.

I've looked at the 'element exists' or 'enters viewport' options, such as #location and id="pagename", but I believe I'd then need to set this across each page, and it's a pretty large site 🙂

So, what is the best way of using DTM's functionality to efficiently tag up an ajax/angular based site?

Cheers, Jez

Replies

Avatar

Avatar
Boost 5
Employee
Rudi_Shumpert
Employee

Likes

8 likes

Total Posts

64 posts

Correct Reply

24 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Applaud 5
Affirm 5
View profile

Avatar
Boost 5
Employee
Rudi_Shumpert
Employee

Likes

8 likes

Total Posts

64 posts

Correct Reply

24 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Applaud 5
Affirm 5
View profile
Rudi_Shumpert
Employee

15-10-2015

You would either use the 'element exists' or 'enters viewport' like to mentioned, or take advantage of our Direct Call Rules.

-Rudi

Avatar

Avatar
Validate 1
Employee
Ben_Bytheway
Employee

Likes

40 likes

Total Posts

62 posts

Correct Reply

22 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile

Avatar
Validate 1
Employee
Ben_Bytheway
Employee

Likes

40 likes

Total Posts

62 posts

Correct Reply

22 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile
Ben_Bytheway
Employee

15-10-2015

Hey Jerome,

I posted this in another question about using DTM in angular (http://help-forums.adobe.com/content/adobeforums/en/analytics-forum/adobe-analytics.topic.html/forum...), but here is what I said:

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.  🙂

Avatar

Avatar
Validate 1
Level 3
jeromerichard
Level 3

Likes

31 likes

Total Posts

28 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile

Avatar
Validate 1
Level 3
jeromerichard
Level 3

Likes

31 likes

Total Posts

28 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile
jeromerichard
Level 3

15-10-2015

Thanks bbytheway, that's really helpful - do you know if s.t() and _satellite.pageBottom() are interchangeable?

Avatar

Avatar
Validate 1
Level 3
jeromerichard
Level 3

Likes

31 likes

Total Posts

28 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile

Avatar
Validate 1
Level 3
jeromerichard
Level 3

Likes

31 likes

Total Posts

28 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile
jeromerichard
Level 3

15-10-2015

Thanks Rudi - I'm liking the direct call rules, and have already used then for some video milestone measurement, is there any down side to using them, or any limits on the number of direct call rules?