Expand my Community achievements bar.

Join us January 15th for an AMA with Champion Achaia Walton, who will be talking about her article on Event-Based Reporting and Measuring Content Groups!
SOLVED

How to record Visit ID in an eVar?

Avatar

Level 1

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!

1 Accepted Solution

Avatar

Correct answer by
Employee

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.

View solution in original post

5 Replies

Avatar

Level 4

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

Avatar

Level 1

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!

Avatar

Level 5
Yes, s_vi is Visitor ID which will not change until cookie is cleared

Avatar

Correct answer by
Employee

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.

Avatar

Level 2
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