Hello, we are using Activity Map, and when clicking on a CTA, we want it to capture the href value of the link rather than the button's name. We have employed a dataElement with the Activity Map customizer extension, but it retrieves the entire URL, and we need to exclude parameters from the button's URL. Is it possible to achieve this? Thank you.
Views
Replies
Total Likes
It should be possible.. but full disclosure, I've never used this extension...
I have done all my Activity Map customizations via code in the Analytics extension custom code area....
So basically, I modified our tracking to take the link name from links, the button text from buttons, and the alt text from images wrapped in anchor tags (where there was no "link text").
Starting with the basic code:
s.ActivityMap.link = function(clickedElement) {
var linkId;
if (clickedElement && clickedElement.tagName.toUpperCase() === 'A') {
// This will take the "title attribute"
linkId = clickedElement.getAttribute('title');
}
return linkId;
}
Obviously, this isn't what you want, but you should be able to take the href attribute instead of the title...
You can then add some JS to remove parameters if they exist, something like:
s.ActivityMap.link = function(clickedElement) {
var linkId;
if (clickedElement && clickedElement.tagName.toUpperCase() === 'A') {
// This will take the "href attribute"
linkId = clickedElement.getAttribute('href');
if (linkId && linkId.indexOf('?') > -1){
linkId = linkId.substr(0, linkId.indexOf('?'));
}
}
return linkId;
}
This can just be added to the top of the custom code in your extension, it does not need to be called in s_doPlugins.
When the Analytics script is loaded, this code will run and manipulate how Activity Map reads the clicked elements.
You will want to test this obviously, and maybe make additional tweaks to the code.
Hi Jennifer,
Thank you very much for your reply.
Unfortunately, the solution cannot be applied as it overwrites the original function found in Adobe Analytics, i.e. it modifies the functionality of the extension. We are trying to create a code where a new dataElement is created that calls the functionality of the Adobe Analytics extension and removes the parameters from the URL.
Any help is welcome.
Thanks
Views
Replies
Total Likes
You can attempt to use the s_object attribute on your buttons.. someone else was having issues with this, but it may have been specific to other parts of their implementation...
This will of course require your developers to add this attribute to all of the elements that you need modified.
Views
Replies
Total Likes