I am trying to set an eVar using custom code in Launch through the Analytics Extension. So far, nothing is working, no matter how I try to set it. I see the data that I want in the console, so I know I am receiving it correctly. Is there something I need to do differently or include? I see the test string for the link track as well...
console.log("%c ******", "color: red; font-size: 20px");
_satellite.logger.log(event.element.getAttribute('data-acid'));
let evarValue = event.element.getAttribute('data-acid') || "No Data Written";
_satellite.logger.log(evarValue);
// s.linkTrackVars = "eVar87";
s.eVar87=evarValue;
s.tl(this,'o','Link Track in JS v2 Test')
Solved! Go to Solution.
Views
Replies
Total Likes
I set eVars in Custom Code all the time, so I know it works.
However, I can see that you are sending a custom link, so you will need the s.linkTrackVar to be set (it's currently commented out), but if there are other dimensions / metrics also being set by the Adobe Extension, all of them will have to be set in the declaration as well.
For instance, if you are using the Set Variables to set eVar1 and prop1, instead of just:
s.linkTrackVars = "eVar87";
You will need to have:
s.linkTrackVars = "prop1,eVar1,eVar87";
(order doesn't matter)
To ensure that the Custom Link sends all the dimensions on the tracking call.
Where is this code being added in Launch? It is inside action of a Rule right? I am checking in case this isn't somewhere (like a Data Element) being executed before the s object is ready on the page, which could be causing the last two lines to fail.
I set eVars in Custom Code all the time, so I know it works.
However, I can see that you are sending a custom link, so you will need the s.linkTrackVar to be set (it's currently commented out), but if there are other dimensions / metrics also being set by the Adobe Extension, all of them will have to be set in the declaration as well.
For instance, if you are using the Set Variables to set eVar1 and prop1, instead of just:
s.linkTrackVars = "eVar87";
You will need to have:
s.linkTrackVars = "prop1,eVar1,eVar87";
(order doesn't matter)
To ensure that the Custom Link sends all the dimensions on the tracking call.
Where is this code being added in Launch? It is inside action of a Rule right? I am checking in case this isn't somewhere (like a Data Element) being executed before the s object is ready on the page, which could be causing the last two lines to fail.
Wow thank you for your suggestion. I will make those changes and give update. Yes I am setting this inside a rule in the Analytics Set Variables
Ok, perfect. This is where I set my custom code as well.
One of my "tricks" is that I have a long list of correlation variables that I use on all clicks / actions, then some actions have their own unique dimensions... so in my Adobe Analytics extension, I set my base dimensions into a window scoped variable:
window.correlationVariables = "prop1,prop2,eVar1,eVar2,eVar3";
Then in my custom code I use:
s.linkTrackVars = window.correlationVariables + ",eVar87";
So that I don't have to write out the full list of items each time, and just focus on adding my specific dimensions for each use.... If I then add a new dimension that needs to be added everywhere, I only have to edit the one line of code where I set the initial list.
So, this didn't fix it directly BUT, your thought process of containing all the props and evars, etc... Made me think of a weird config that we had that I never touched cause of legacy work. I looked inside there and evar87 was being set by a query param. I took it out and boom it worked. I am using your previous update to how I structured the new rule I am creating so THANK YOU much for your insight!!!
You're very welcome! Also, I am glad you found that legacy configuration.
Views
Likes
Replies