s.getPreviousValue not working for other eVars than page name and channel | Community
Skip to main content
chrisludwig87
Level 2
Sep 23, 2024 1:17 PM UTC
Solved

s.getPreviousValue not working for other eVars than page name and channel

Hi there,

I do initialize the getPreviousValue-Plugin with Data Collection and then setting two eVars by using an additional rule, the Adobe Analytics extension and custom code looking like this:

s.eVar18 = s.getPreviousValue(s.pageName,"gpv_pageName"); s.eVar19 = s.getPreviousValue(s.channel,"gpv_siteSection");

Everything is working fine for this. Cookies are set, eVars are set as soon as cookies have a value.

Now, I'm trying to add an additional line, looking like this:

s.eVar17 = s.getPreviousValue(s.eVar2,"gpv_pageId");

For this one, no cookie is built and therefore no eVar is set while eVar2 exists in the tracking calls.

Can someone tell me why?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
bjoern__koth
bjoern__kothAccepted solution
New Participant
Sep 23, 2024 5:38 PM UTC

Hi @chrisludwig87 

are you sure that eVar2 has been set by the time you are calling getPreviousValue?

What if you log it in the console? Do you see an actual value present?

_satellite.logger.debug(">>> this is eVar2", s.eVar2);
Cheers from Switzerland!

7 replies

bjoern__koth
bjoern__kothAccepted solution
New Participant
Sep 23, 2024 5:38 PM UTC

Hi @chrisludwig87 

are you sure that eVar2 has been set by the time you are calling getPreviousValue?

What if you log it in the console? Do you see an actual value present?

_satellite.logger.debug(">>> this is eVar2", s.eVar2);
Translate
Cheers from Switzerland!
chrisludwig87
Level 2
Sep 24, 2024 8:05 AM UTC

That's it. I just changed the load order so that the rule explicitly for the GPV-values is a step after the "basic variable" set and now it's working. This means eVar2 wasn't set when the GPV jumped in—timing issue.

Translate
bjoern__koth
New Participant
Sep 24, 2024 8:06 AM UTC

Great you figured it out!

Translate
Cheers from Switzerland!
Jennifer_Dungan
Level 2
Sep 23, 2024 1:49 PM UTC

Hmm on the surface, this looks fine... 

 

The only thing I can think of is your eVar2 being explicitly set? Or is it maintaining a value from a previous page (I assume not since it's called "page id", so I would expect that to be set for every page)

 

There should be no difference between maintaining the value of pageName or channel, or an eVar.... I even see eVars in the examples in the documentation.

 

Are you seeing any errors in your console?

 

I don't use this plugin, so to try and replicate I need to do some setup.... 

Translate
chrisludwig87
Level 2
Sep 23, 2024 1:57 PM UTC

Thanks for your thoughts. I don't get any console errors. You're right, s.eVar2 is set on every page tracking call. It feels weird that both others are working as expected, seeing no difference to s.eVar2.

Translate
Jennifer_Dungan
Level 2
Sep 23, 2024 2:54 PM UTC

It really does.... just for a test.. can you try something else? just to see if the cookie gets properly set? Maybe try a prop and another eVar (something that should always be there)... 

Translate