Have s.clearVars clear pageName too! | Community
Skip to main content
jkunz
Level 3
June 12, 2018
New

Have s.clearVars clear pageName too!

  • June 12, 2018
  • 3 replies
  • 3633 views

It looks like currently s.clearVars clears just about everything BUT pageName:
function(){var c,b;for(c=0;c<a.g.length;c++)if(b=a.g[c],"prop"==b.substring(0,4)||"eVar"==b.substring(0,4)||"hier"==b.substring(0,4)||"list"==b.substring(0,4)||"channel"==b||"events"==b||"eventList"==b||"products"==b||"productList"==b||"purchaseID"==b||"transactionID"==b||"state"==b||"zip"==b||"campaign"==b)a[b]=void 0}

The problem is, on single page apps (which is probably the biggest use case for using clearVars), I need pageName cleared out as well.
For instance, I have some logic that sets the pageName based on the URL, but only if s.pageName hasn't already been set for that beacon. The problem is, if pageName is ever set, it hangs around, so it always looks like s.pageName is set, even if it wasn't set for that beacon. I'm having to run clear vars, THEN go in and manually clear out s.pageName as well.

This affects the Launch Adobe Analytics extension "clear vars" action as well, since that just uses the s.clearVars() function (from what I'm told).

Along the same lines, s.clearVars does not clear s.contextData either.  I suspect when people use clearVars, they want ALL variables to be cleared.

3 replies

Adobe Employee
June 12, 2018

Good and useful feature request!

s.clearVars was a method to clear the variables. Earlier, it was mainly used to clear variables which was persisting in s.tl() calls (through s.linkTrackVars and s.linkTrackEvents).... since s.tl() calls didn't consider page names, we ignored that?

Just a wild guess..

jantzen_b
Adobe Employee
Adobe Employee
October 27, 2020
No text available
Community Manager
October 5, 2022
No text available