Hi Ram,
There are 2 topics on your context
- The URL doesn't know the context is it HREF in: Button or Link, what you would do if to add a label for all the tracked link via the _label element and you could introduce a naming convention (btn, lnk, img). The label is what is seen in the URL & Clickstream reports and is Adobe internal only.
- The 2nd part is the trickiest one as in the TrackingFormula associated to the Web Analytics external account, you would have to loop through the list of tracked URL, matching to the one current prepared, look at whether it contains one of the naming convention and set the content_tum accordingly. The code would look like as below
<%@ include option='NmsTracking_ClickFormula' %><% var pattern = new RegExp("(^(http|https)://(.*))", 'i'); if ($(urlstring).match(pattern)) { var contentType; for (var x=0; x<delivery.content.html.urlConfig.url.length; x++) { if (delivery.content.html.urlConfig.url[x].tagId == "$(urlId)" && delivery.content.html.urlConfig.url[x].label > "") { contentType =delivery.content.html.urlConfig.url[x].label; }} contentType = contentType.replace(/\s/g,"_"); %>&utm_content=<%= escapeUrl(contentType) %>&cid=<%= message.delivery.internalName %>&bid=<%= message.id.toString().toLowerCase() %><% } %>
The above code loops through the list to tracked URL and will put the delivery label in the utm_content parameter, you would have to rework it that the label of the URL is tested to include btn, img or lnk as part of it to set the utm_content accordingly.
Try the above to ensure it compiles and works and then adapt to your need.
All I can think of and I hope it helps.
Thanks,
Denis