Have beacon URL update on Single Page Apps

Avatar

Avatar
Validate 1
Level 7
jkunz
Level 7

Likes

201 likes

Total Posts

33 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 25
View profile

Avatar
Validate 1
Level 7
jkunz
Level 7

Likes

201 likes

Total Posts

33 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 25
View profile
jkunz
Level 7

12-06-2018

Currently, on a single page app, my first beacon will have the correct URL. But if I navigate to another page, and there is a history/state/URL change without loading a new DOM, my URL does NOT update- my "g" parameter in my beacon still reflects the first page loaded.
These days, most single page apps DO update the URL as the user navigates around; it would be good to have that URL reflected in analytics.
I often manually force this by doing something like "s.pageURL=document.location.href" in doPlugins or similar, but it would be great to have it be built in- folks get confused when they see my workaround because they think "isn't that what pageURL is automatically?" (answer: not on a single page app).

6 Comments

Avatar

Avatar
Give Back 50
Level 6
pabloc82923542
Level 6

Likes

78 likes

Total Posts

358 posts

Correct reply

82 solutions
Top badges earned
Give Back 50
Give Back 5
Give Back 3
Give Back 25
Give Back 10
View profile

Avatar
Give Back 50
Level 6
pabloc82923542
Level 6

Likes

78 likes

Total Posts

358 posts

Correct reply

82 solutions
Top badges earned
Give Back 50
Give Back 5
Give Back 3
Give Back 25
Give Back 10
View profile
pabloc82923542
Level 6

19-06-2018

The problem here is that you should be using direct call rules to then allow the single page app to fire beacons as need when users navigate around the APP. Very good user case for this is Angular based Apps.... Then its just a matter if developer building app correctly to accommodate (pageview like reporting).

Avatar

Avatar
Validate 1
Level 7
jkunz
Level 7

Likes

201 likes

Total Posts

33 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 25
View profile

Avatar
Validate 1
Level 7
jkunz
Level 7

Likes

201 likes

Total Posts

33 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 25
View profile
jkunz
Level 7

25-06-2018

This applies even when using DCRs. I know how to update pageName and custom variables and all of that on a new page view- and I do know how to manually override the URL to have the new beacon reflect the new url, using s.pageURL. What I'm asking for in this idea is for the url to update automatically.

For instance, currently, when my SPA loads, my first beacon might have:
g = http://www.mydomain.com/home.html
pageName = home
events= event1
prop1= D=g

Then the user browses to a new page (http://www.mydomain.com/products.html), I update the data layer, fire _satellite.track("page view") or somesuch, and my next beacon would have:

g = http://www.mydomain.com/home.html

pageName = products

events= event2
prop1= D=g


The appMeasurement library does not update the url to http://www.mydomain.com/products.html but rather just holds on to the URL from when the DOM first loaded.

The current work around is to add to your DCR/EBR, or to doPlugins, something like this:
s.pageURL=document.location.href

But a lot of folks don't know to do that.

Avatar

Avatar
Give Back 50
Level 6
pabloc82923542
Level 6

Likes

78 likes

Total Posts

358 posts

Correct reply

82 solutions
Top badges earned
Give Back 50
Give Back 5
Give Back 3
Give Back 25
Give Back 10
View profile

Avatar
Give Back 50
Level 6
pabloc82923542
Level 6

Likes

78 likes

Total Posts

358 posts

Correct reply

82 solutions
Top badges earned
Give Back 50
Give Back 5
Give Back 3
Give Back 25
Give Back 10
View profile
pabloc82923542
Level 6

25-06-2018

I see some of the dilemma. In this case the data layer via the app needs to be changed to reflect the new (virtual URL).

Again the pagename and URL variable(g) parameter for that matter can be modified for the state change of the APP. Its all relying on the APP to update as needed the variables. Its really a case of the APP developer building an infrastructure to allow the Direct call rules to fire when needed and then ensure things like(present URL, previous URL) are set at the correct time.

GLTU

Avatar

Avatar
Validate 1
Level 7
jkunz
Level 7

Likes

201 likes

Total Posts

33 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 25
View profile

Avatar
Validate 1
Level 7
jkunz
Level 7

Likes

201 likes

Total Posts

33 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 25
View profile
jkunz
Level 7

26-06-2018

I think you may still be missing the idea I'm proposing here. The appMeasurement library automatically sets the URL into the "g" parameter. The problem is, the logic that does this may be outdated as it doesn't work well in SPAs, where a single DOM may change states/URLs multiple times. In these cases, appMeasurement doesn't realize the URL has changed and continues setting the "g" parameter with the original URL.
A developer who is aware of this problem can get around it easily enough by manually overwriting that G parameter- I already know how to do this. I'm proposing Adobe update the appMeasurement logic so that the "g" param always reflects the current url.

Avatar

Avatar
Validate 1
MVP
Jennifer_Kunz
MVP

Likes

313 likes

Total Posts

85 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Contributor
Seeker
Shape 10
Shape 1
View profile

Avatar
Validate 1
MVP
Jennifer_Kunz
MVP

Likes

313 likes

Total Posts

85 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Contributor
Seeker
Shape 10
Shape 1
View profile
Jennifer_Kunz
MVP

15-01-2019

On another note, this also impacts getQueryParam functionality- I believe s(.Util.)getQueryParam takes advantage of s.pageURL, so unless you're updating s.pageURL currently, you might inflate tracking on query params.

Avatar

Avatar
Validate 1000
Community Manager
jantzen_belliston-Adobe
Community Manager

Likes

339 likes

Total Posts

2,333 posts

Correct reply

819 solutions
Top badges earned
Validate 1000
Springboard
Validate 500
Validate 250
Validate 100
View profile

Avatar
Validate 1000
Community Manager
jantzen_belliston-Adobe
Community Manager

Likes

339 likes

Total Posts

2,333 posts

Correct reply

819 solutions
Top badges earned
Validate 1000
Springboard
Validate 500
Validate 250
Validate 100
View profile
jantzen_belliston-Adobe
Community Manager

27-10-2020

 
Status changed to: Archived