Can I have more than one s.ActivityMap.regionIDAttribute

Avatar

Avatar
Validate 1
Level 2
nicholasr284932
Level 2

Likes

4 likes

Total Posts

4 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Give Back
Boost 3
Boost 1
Applaud 5
View profile

Avatar
Validate 1
Level 2
nicholasr284932
Level 2

Likes

4 likes

Total Posts

4 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Give Back
Boost 3
Boost 1
Applaud 5
View profile
nicholasr284932
Level 2

04-03-2019

I recently changed my s.ActivityMap.regionIDAttribute to "region_id" but I still wanted activity map to default to "id" if "region_id" was not set. I thought this was the default behavior but I'm noticing activityMap returning a regionID of "BODY" when "region_id" is not defined. Can I pass an array or a delimited string to s.ActivityMap.regionIDAttribute to have it try "region_id" and then fall back to "id" or will it only ever take one identifier?

-- Nick

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Applaud 500
MVP
Asheesh_P
MVP

Likes

130 likes

Total Posts

334 posts

Correct reply

146 solutions
Top badges earned
Applaud 500
Affirm 100
Contributor
Boost 100
Give Back 10
View profile

Avatar
Applaud 500
MVP
Asheesh_P
MVP

Likes

130 likes

Total Posts

334 posts

Correct reply

146 solutions
Top badges earned
Applaud 500
Affirm 100
Contributor
Boost 100
Give Back 10
View profile
Asheesh_P
MVP

27-04-2019

Hi Nick,

Setting conditions to fall back to "id" when "region_id" should not be a problem. You will need to modify "AppMeasurement ActivityMap Module" file.

Below example returns "BODY" when parentNode is not available, here you can make an update to return "id" in while coding block.

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";

}

Useful links:

https://marketing.adobe.com/resources/help/en_US/analytics/activitymap/activitymap-link-tracking-met...Differentiating Multiple links that Reference the same Link ID and Region  

https://marketing.adobe.com/resources/help/en_US/analytics/activitymap/activitymap-link-tracking-met...

Thanks!

Asheesh

Answers (1)

Answers (1)

Avatar

Avatar
Validate 1
Level 2
nicholasr284932
Level 2

Likes

4 likes

Total Posts

4 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Give Back
Boost 3
Boost 1
Applaud 5
View profile

Avatar
Validate 1
Level 2
nicholasr284932
Level 2

Likes

4 likes

Total Posts

4 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Give Back
Boost 3
Boost 1
Applaud 5
View profile
nicholasr284932
Level 2

13-08-2019

So what I finally ended up doing was below. It takes either the defined activitymap.regionIDAtttribute or uses "region_id". If it can't find either of those and hit 'id' first it uses that. All else fails it returns 'body'

   e.region = function (a) {

   for (var d, b = e.regionIDAttribute || "region_id"; a && (a = a.parentNode);) {

   if (d = q(a, b, b, b)) return d;

   if (d = q(a, 'id', 'id','id')) return d;

   if ("BODY" == a.nodeName) return "BODY"

  }

  }