Differentiate links that reference the same Link ID and region

You can differentiate links by customizing the link ID using the s_objectID variable, by customizing the region, and by customizing the AppMeasurement ActivityMap module file .

As an example, let’s say you have multiple “Buy” links that are identified by Activity Map under the same Link ID and Region:

Code sample Link ID Region
<div id="recommendation panel">
  <div>
    <a href="product1.html">Buy</a>
  </div>
  <div>
    <a href="product2.html">Buy</a>
  </div>
  <div>
    <a href="product3.html">Buy</a>
  </div>
</div>
 
 
Buy
 
 
Buy
 
 
Buy
 
 
 
 
recommendation panel
 
 
recommendation panel
 
 
recommendation panel
 
 

How can you customize your web page and tagging to differentiate the values of these links? You have three options: You can customize the Link ID, or customize the region, or customize the AppMeasurement ActivityMap Module file.

Customize the Link ID Using s_objectID

By creating a unique object ID, s_objectID, for a link or link location on a page, you can either improve Activity Map tracking or use Activity Map to report on a link type or location, rather than the link URL. Click here for more information on the s_objectID variable.

IMPORTANT

Note that a trailing semicolon (;) is required when using s_objectID in Activity Map.

Code Sample Link ID Region
<div id="recommendation panel">
  <div>
    <a onClick="s_objectID='Product1';" href="product1.html">Buy</a>
  </div>
  <div>
    <a onClick="s_objectID='Product2';" href="product2.html">Buy</a>
  </div>
 <div>
    <a onClick="s_objectID='Product3';" href="product3.html">Buy</a>
  </div>
</div>
 
 
Product1
 
 
Product2
 
 
Product3
 
 
 
 
recommendation panel
 
 
recommendation panel
 
 
recommendation panel
 
 

Customize the Region

You can customize the region by ensuring that each “Buy” link has its own Region defined. To do so, add an "id" parameter to one of the parents of each “Buy” anchor tag.

NOTE

You are not strictly limited to the "id" parameter as a region identifier. You can also set your own identifier using the JavaScript variable "s.ActivityMap.regionIDAttribute".

Code Sample Link ID Region
<div id="recommendation panel">
  <div id="region a">
    <a href="product1.html">Buy</a>
  </div>
  <div id="region b">
    <a href="product2.html">Buy</a>
  </div>
  <div id="region c">
    <a href="product3.html">Buy</a>
  </div>
</div>
 
 
Buy
 
 
Buy
 
 
Buy
 
 
 
 
region a
 
 
region b
 
 
region c
 
 

Customize the AppMeasurement ActivityMap Module file

CAUTION

Make sure you test the modified code to ensure that it works properly. Adobe is not responsible for how the modified code behaves.

Here are a couple of examples of generic link/region functions you could include (in modified form) in your AppMeasurement.js file.

s.ActivityMap.link = function(ele, linkName) {
  if (linkName) {
    return linkName;
  }
  if (ele) {
    if (ele.tagName == 'A' && ele.href) {
      return ele.href;
    }
  }
}

The linkName is passed during calls to s.tl().

s.ActivityMap.region = function(ele) {
  var className,
  classNames = {
    'header': 1,
    'navbar': 1,
    'left-content': 1,
    'main-content': 1,
    'footer': 1,
  }; 
  while ((ele && (ele = ele.parentNode))) {
    if ((className=ele.className) && classNames[className]) {
      return className;
    }
  }
  return "BODY";
}

On this page

Adobe Summit Banner

A virtual event April 27-28.

Expand your skills and get inspired.

Register for free
Adobe Summit Banner

A virtual event April 27-28.

Expand your skills and get inspired.

Register for free
Adobe Maker Awards Banner

Time to shine!

Apply now for the 2021 Adobe Experience Maker Awards.

Apply now
Adobe Maker Awards Banner

Time to shine!

Apply now for the 2021 Adobe Experience Maker Awards.

Apply now