Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Is it possible to clear 1 var and not all vars?

Avatar

Avatar
Validate 1
Level 1
edwardb44196902
Level 1

Likes

3 likes

Total Posts

20 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
Applaud 5
View profile

Avatar
Validate 1
Level 1
edwardb44196902
Level 1

Likes

3 likes

Total Posts

20 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
Applaud 5
View profile
edwardb44196902
Level 1

15-04-2021

So let's say we go to a site and click through items, is it possible to capture a var for the first time and then clear it out so it does not persist on the page?

 

Example:

 

1.Go to website - Page view analytics

2. Click More Details - s.tl click analytics -- we want to capture a custom eVar/prop here

3. Click close details - s.tl click analytics but we don't want the custom eVar/prop in this call or anything afterwards, we don't want to clear all variables because we want to maintain all variables in here except the custom eVar/prop from the initial click.

Accepted Solutions (0)

Answers (1)

Answers (1)

Avatar

Avatar
Establish
MVP
evolytics_brian
MVP

Likes

70 likes

Total Posts

145 posts

Correct Reply

44 solutions
Top badges earned
Establish
Seeker
Give Back
Engage 1
Boost 50
View profile

Avatar
Establish
MVP
evolytics_brian
MVP

Likes

70 likes

Total Posts

145 posts

Correct Reply

44 solutions
Top badges earned
Establish
Seeker
Give Back
Engage 1
Boost 50
View profile
evolytics_brian
MVP

20-04-2021

@edwardb44196902 -
Question for you: Can't you just set the eVar's allocation to first/original, specify the desired expiration, and be done with it? Or, does that for some reason not work for what you're trying to accomplish?


Assuming expiration/allocation aren't feasible solutions here, I'd say it's definitely possible, but you'll have to build a custom solution that fits your requirements. Based on the little i know from your initial post, I'd probably go with a simple Boolean JS flag that gets set and evaluated in doPlugins(). Something like this...

var hasVarAlreadyBeenTracked = false;

// only populate the eVar the first time through
if (!hasVarAlreadyBeenTracked) {
  s.eVar1 = _satellite.getVar("data-element-for-this-evar");
  hasVarAlreadyBeenTracked = true;
} else {
  s.eVar1 = "";
}

If you want this behavior to persist across multiple pages, you'll have to store the flag in a cookie or other browser storage.