Capture Activity Map Context Data

Avatar

Avatar

MktgCloudUser

Avatar

MktgCloudUser

MktgCloudUser

11-01-2019

Hello,

I need to capture the Activity Map "region" whenever the user clicks a link on my site but before the s.tl action is fired.  I am aware I can use Processing Rule to copy this value but I need the value client-side.  I can see the value in the EC Debugger so I know it's working properly.

I've tried the following without success:

console.log('activity map value=' + s.contextData['a.activitymap.region']);

console.log('activity map value=' + s.contextData['c.a.activitymap.region']);

console.log('activity map value' + s.ActivityMap.region);

Any thoughts on how I can get this value?

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

Gigazelle

Employee

Total Posts

1.9K

Likes

460

Correct Answer

734

Avatar

Gigazelle

Employee

Total Posts

1.9K

Likes

460

Correct Answer

734
Gigazelle
Employee

15-02-2019

The plugins function should be doing the trick, but if not, you could use Object.watch() to determine when the contextData variable changes, then insert your code after that takes place. I found this thread on StackOverflow that might help:

javascript - Break on a change of variable value - Stack Overflow

Basically you'll want to figure out exactly when the activity map variable is populated, then you'll be able to insert your own code after that (but before the image request is sent). Bear in mind that this might require inserting code where Adobe says you shouldn't, but hopefully that isn't the case.

Answers (4)

Answers (4)

Avatar

Avatar

MktgCloudUser

Avatar

MktgCloudUser

MktgCloudUser

08-02-2019

Gigazelle​ - nope, unfortunately that didn't work.  I tried all three in the original post inside of the doPlugins and got the following in the console (basically the same as outside of the doPlugins section):

activity map value=

activity map value=undefined

activity map value=function(e){for(var t,a=f.regionIDAttribute||"id";e&&(e=e.parentNode);){if(t=o(e,a,a,a))return t;if("BODY"==e.nodeName)return"BODY"}}

Maybe there's a different function I should be using?

Avatar

Avatar

Gigazelle

Employee

Total Posts

1.9K

Likes

460

Correct Answer

734

Avatar

Gigazelle

Employee

Total Posts

1.9K

Likes

460

Correct Answer

734
Gigazelle
Employee

07-02-2019

You should be able to grab the variable value if you do so inside the doPlugins() function. Could you give that a shot and let me know if that works?

Avatar

Avatar

MktgCloudUser

Avatar

MktgCloudUser

MktgCloudUser

04-02-2019

I wish to capture the same value being reported in the Experience Cloud Debugger before it is submitted via the s.tl request.

2019-02-04_10-49-51.jpg

Avatar

Avatar

pabloc82923542

Avatar

pabloc82923542

pabloc82923542

11-01-2019

Can you expand on what it is you are trying to accomplish?

What is the region data going to help you with?