How to record Visit ID in an eVar? | Community
Skip to main content
New Participant
Oct 16, 2015 2:26 AM UTC
Solved

How to record Visit ID in an eVar?

Hi,

Our client wants to record visit ID in an eVar and we were looking for some kind of solution. Is there any way to do this with dynamic variables? And if not, maybe the concatenation of Visitor ID + Visit Number would work (also through dynamic variables)?

We would really appreciate some help on that.

Thanks!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
jhammons-1Accepted solution
Employee
Oct 16, 2015 2:26 AM UTC

You are correct about s_vi being the visitor ID, this should stay the same for every visit (at least we hope so!). The visit ID (the visit number part) is calculated after the hit is collected so it isn't available through dynamic variables.

I think you can get what you are after using a combination of the visitor ID and visit number from the getVisitNum implementation plugin, http://microsite.omniture.com/t2/help/en_US/sc/implement/#getVisitNum

Instead of using the s_vi dynamic variable, I'd suggest reading the s_vi cookie directly, then reading the s_fid fallback cookie, and then doing something else if this fails (either don't set the variable so it reports as "None", or set it to something custom). That way you won't get an empty ID for visitors who aren't cookied.

var id = s.c_r('s_vi') != "" ? s.c_r('s_vi') : s.c_r('s_fid'); if (id != "") { var dt = new Date(); s.eVar1 = id + "|" + dt.getUTCMonth() + "|" + dt.getUTCFullYear() + "|" + s.getVisitNum(); } else { //do something else, user does not accept any cookies... }

This should result in something like:

4E39CEC3FE367A9A-178C79544A5B6A15|2|2014|1

4E39CEC3FE367A9A-178C79544A5B6A15|2|2014|2

You'll need to customize this more for your needs but it should get you going down the right path.

5 replies

Level 4
Oct 16, 2015 2:26 AM UTC

Hi Barbara,

Did you try using s_vi to store SiteCatalyst cookie values?

e.g. s.propXX="D=s_vi"

This link provides more details of Dynamic Variables: http://adobe.ly/1fQfYa9

Translate
New Participant
Oct 16, 2015 2:26 AM UTC

Hi JiMa,

I thought that the s_vi is the visitor ID and not the VISIT ID. Am I right? I've done some tests and it doesn't change from one visit to another.

Any other ideas?

Thanks a lot!

Translate
Level 4
Apr 29, 2021 3:27 PM UTC
Yes, s_vi is Visitor ID which will not change until cookie is cleared
Translate
jhammons-1Accepted solution
Employee
Oct 16, 2015 2:26 AM UTC

You are correct about s_vi being the visitor ID, this should stay the same for every visit (at least we hope so!). The visit ID (the visit number part) is calculated after the hit is collected so it isn't available through dynamic variables.

I think you can get what you are after using a combination of the visitor ID and visit number from the getVisitNum implementation plugin, http://microsite.omniture.com/t2/help/en_US/sc/implement/#getVisitNum

Instead of using the s_vi dynamic variable, I'd suggest reading the s_vi cookie directly, then reading the s_fid fallback cookie, and then doing something else if this fails (either don't set the variable so it reports as "None", or set it to something custom). That way you won't get an empty ID for visitors who aren't cookied.

var id = s.c_r('s_vi') != "" ? s.c_r('s_vi') : s.c_r('s_fid'); if (id != "") { var dt = new Date(); s.eVar1 = id + "|" + dt.getUTCMonth() + "|" + dt.getUTCFullYear() + "|" + s.getVisitNum(); } else { //do something else, user does not accept any cookies... }

This should result in something like:

4E39CEC3FE367A9A-178C79544A5B6A15|2|2014|1

4E39CEC3FE367A9A-178C79544A5B6A15|2|2014|2

You'll need to customize this more for your needs but it should get you going down the right path.

Translate
Level 2
Jan 26, 2021 7:51 AM UTC
For people using appMeasurement, the updated getVisitNum plugin code is currently (Jan 2021) available here : https://experienceleague.adobe.com/docs/analytics/implementation/vars/plugins/getvisitnum.html
Translate