Expand my Community achievements bar.

SOLVED

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

Avatar

Level 2

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?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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!


View solution in original post

7 Replies

Avatar

Community Advisor and Adobe Champion

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

Avatar

Level 2

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.

Avatar

Community Advisor and Adobe Champion

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

Avatar

Correct answer by
Community Advisor

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!


Avatar

Level 2

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.

Avatar

Community Advisor and Adobe Champion

Yes, glad you figured it out