The problem with setting global variables in the Adobe Analytics Extension.

On this page, I've set in my Analytics Extension Global Variables: pageName to %page name% (which pulls from digitalData.page.pageName), and eVar15 to %auth state% (which pulls from digitalData.user.authState). On page load, I get a beacon that correctly sets both of these variables. If I were to clear variables, eVar15 would not be present on any subsequent beacons, because Global Vars only evaluates once, on page load, and clear vars would have wiped out any variables (other than pageName, which clearVars doesn't touch.)

So maybe I don't clearVars... eVar15 should hang around then, right? Not if any subsequent beacon is an s.tl beacon, because s.tl beacons only pick up variables specified in s.linkTrackVars, and Global Variables don't do anything to linkTrackVars.

OK, so... no clearing variables, and let's keep all my beacons as s.t, so I don't have to worry about linkTrackVars.

If I log in:

Click to pretend to login.

Then _satellite.getVar("auth state") now correctly reflects that I am logged in. BUT, my beacon will not. It still says "not logged in" because that was the original value, and global variables don't reevaluate after the first page load.

Let's say my login rule clears out variables after it runs. Any subsequent beacons will not have eVar15 set.

Now pretend I'm a single page app and click to pretend to load a new virtual page which should have its own page name (_satellite.getVar("page name") should be "this is a new page", though I'm lazy and not actually making anything about the page, other than the data layer, change for this example).

Unfortunately, my second page's page view beacon still says the page name is "Home" because that was the original value, and global variables don't reevaluate after the first page load. And eVar15 is gone, because I used clear variables at some point.

The moral of the story: Adobe, please fix the way global variables work in the analytics extension. Not adobe folks: beware the pitfalls of Global variables in the analytics extension.