We set the eVar2 as most recent and expire after visit as we need to persist this eVar in our application.
However in the flow for one scenario, we need to clear this eVar and set to not triggered and also need to clear the persisted value
Consider a booking flow and we provide an offer for few customers
when they start the booking flow we apply this offer and tracking using an eVar 2.
eVar 2 = offer 1 and the final bookings are under this offer 1
If they are two offers if the user select the second offer we are overwriting eVar2 = offer 2
And corresponding bookings are attributed to that offer 2
Also in the booking flow customer can remove this offer in this time we don't need to track this booking under any offer.
In this case how to remove the previous eVar 2 value as in this case our system is not passing any offer code.
What is the best practice in this case? Is that okay if we pass eVar2 = " " to over write the previous persisted value.
deleting the eVar in your implementation would result in not sending the data to Adobe Analytics. But it would still persist in reporting (eVar2 still holding the old value).
instead of trying to use a default merchandising variable (eVar), I would suggest you have a look at "products". because basically your user is searching for products with some meta data, adding it to a cart and proceed checkout (purchase/use offer).
the merchandising eVars allows you to "stick" variables to a specific product, eg. you can set eVar2 to "abc" for productX and set eVar2 to "DEF" for productY - all on the same call (Analytics track event).
here are some good resources to read more about:
Best Practive for the above scenario;
A new clearVars method is available to clear the following values from the instance object like eVars, props, etc... To clear eVar2= Offer1 and to clear the Persisted value use when customer visit Offer 2
The s.clearVars('eVar2') Function
Thanks Balaji.. Let me try this way.