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.
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
Hi Jennifer, ExO -
At Summit '23, Rockstar Tips, the same session you presented some tricks with segmentation and relative date ranges, Victoria Stapleton at Acronym Media showed how to create a custom dimension for the Activity Map Link destination URL as an add-on to the existing AM dimensions.
2023 Adobe Analytics Rockstars: Top Tips and Tricks
Her how-to-guide
https://www.acronym.com/adobe-summit/
https://docs.acronym.com/analytics/adobe-analytics/activity-map-destination
It's a bit above my pay grade. I tried to talk our Analytics owners & IT into it, didn't make the cut. My workaround is to break down AM Link by Page or Page URL, which is the destination page - NOT AM Page, that's the page the link was clicked on.
I still think the custom AM dimension has value for condensing many into one (i.e., same link but different text, e.g., translations) and splitting one into many (e.g., micro/button text like "Learn More" that may point to a number of different pages in different contexts).
Looking into the AEM debugger, I see that the Click Map Object ID is the destination URL congruent to the AM Link, but I don't see it in Workspace, so maybe that could be put into a standard conversion variable, not related to AM Map, and an easier ask.
Or maybe you can set up a Custom Link tracking per element, e.g., s.tl(this, "o", linkID) instead of s.ActivityMap.link, the code in Jennifer's first reply, more documentation here) in App Measurement, or maybe adapt s.ActivityMap.link to a rule that only fires in certain regions or on certain elements, for example, where you currently have Activity Map gaps. I'd like to look into both of these solutions when I have time.
Ah, and reading the ExO's OP more thoroughly, maybe they're already using the plug-in that Acronym uses. But then I looked at her preso again and remembered a final tip she gave: you can apply SAINT classifications to your new AM dimension to get pseudo-dimensions in Workspace. So there's a post-hoc solution to removing extra URL params. But I think the best solution will involve manipulating the href string with JS in App Measurement before the fact.
Views
Replies
Total Likes
Interesting catch on the ClickMap Object ID, while the "Click Map" is deprecated, it appears to still be collecting data... With a processing rule, you could capture this value into a custom dimension...
(Replace Page URL in the above with the appropriate dimension).
Or create custom context variables that you map in the same context as Activity Map data, as that plugin shows (that too is a good option to extend what can be collected in a similar fashion.
Both of those sound like great options!
And while yes, you can use s.tl(this, "o", linkID) and pass whatever dimensions and values you want, this will cost additional server calls, fine for really important links, but if you do this for every link in your site it will start to get expensive and negate many of the benefits of Activity Map.
Great follow-up to this older thread!
Views
Replies
Total Likes
Hi again, Jennifer -
It might be best to bring the link URL into the Activity Map, but for expediency, I tried your suggestion of using a processing rule. I enabled a blank eVar and set it to a.ClickMap.link(Context Data), but nothing's coming through into the s object or Workspace.
In the beacon, the ClickMap values are not inside the contextData. ClickMap Object ID seems to be the same as oid; according this doc, oid = s_objectID is "Object identifier for the last page. Used in Activity Map", but here, it's the current page URL, arrived at from the link on the Activity Map Page (Home); maybe it's saved for the next hit, rolls over as you go...? Regardless, it'd work, but I'm not sure how to set my new eVar to this value, it's not in the Context Data list (although the ClickMap values are).
So I guess I'll have to (ask a dev to) go into Launch (Data Collection, sorry
While we're at it, could we avoid the whole Acronym plugin thing and sneak it into the Activity Map like so maybe?
s.contextData['a.activitymap.linkURL'] = {oid parsed from the beacon or custom JS for a@href};
Although here they say don't begin contextData calls with a, it's reserved (for AM I guess).
So maybe the simplest in Launch would be to assign the new Link URL eVar like so?
s.eVar98 = s_objectID
The docs say s_objectID is the click URL by default, but you can change the values if you want to distinguish links further, but link URL would be great!
Sorry to beat this to death, but coming from a GA world, it's kinda flabbergasting to me that Link URL isn't captured out of the box and was also neglected when we were setting up AA.
Views
Replies
Total Likes
Hi @davidl55903031,
Yep, I just confirmed the same... even though the Click URL is captured, the data doesn't appear to make it to the Processing Rules to be usable in a rule.
On a page with an oid value, I tried pulling up s_objectID
in the console.. I wasn't able to get it to work, it just came back empty (I imagine it might not be retrievable in this context).. but by all means, see if you can... What about trying to use "D=oid"; using dynamic variables the same way I use D=mid to capture the ECID / MID value into a dimension.. Using "D=" followed by the payload param is supposed to copy that value into your dimension....
I use D=mid to get the value of mid, and D=g to get a duplication of the current URL into a custom dimension...
In theory s.eVar98="D=oid" might work? You can try coding this right into the Set Variables area:
To be fair though, Activity Map is more designed for page to page navigation (not so much for click tracking on buttons)...
If your flow is literally Page A > Page B (with no actual tracking on the click)... you already have the URL via the tracking that happens on Page B, assuming you have a dimension set up to track the URL on every page.
Activity Map captures the information about the link that was clicked, on what page, in what region of the page...
If in your reporting you want to see where it went, you can simply correlate your activity map data with your eVar1.
However, if you have "click" tracking on the link, that is where things get tricky, since the "current URL" isn't the destination, but the current page where the tracking is triggered.
In my implementation, I only have a few special "click tracking" elements, and since I know where those elements go, I've never really needed to capture the destination...
I hear what you are saying, personally, I actually dislike GA's use the URL as the primary identifier... this means I have to either do extra work to capture the parameters as separate dimension (which due to GA's limitation of 2 levels of breakdowns means I can't really do a lot of deep dives), or I have to leave the params in, but now every variation creates a new row... so I can't see at a glance all the tracking to a page... But I get it, coming from the GA side of things, this is a shift in thinking...
Views
Replies
Total Likes
Thanks, Jennifer, for your thoughtful replies. I'll have to get hands-in and play with it with my dev. May go with custom JS anyway, not that hard. Will report back here when we have something that works.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies