Expand my Community achievements bar.

Join us January 15th for an AMA with Champion Achaia Walton, who will be talking about her article on Event-Based Reporting and Measuring Content Groups!
SOLVED

Can any kind soul help me understand this piece of code -

Avatar

Level 4

Can any kind soul help me understand this piece of code -

function s_getObjectID(o) {
var ID=o.href;
return ID;
}
s.getObjectID=s_getObjectID;

I want to know what is o.href doing?

Regards,

Sanmeet

1 Accepted Solution

Avatar

Correct answer by
Employee

Hi Sanmeet,

I believe this function is used for clickmap.  It is a callback to get the unique ID of the link.  When it is called, the parameter "o" refers to the anchor tag (i.e. <a href="http://adobe.com/"></a>).  So, o.href refers to the href attribute/property of the anchor tag.  Anyone correct me if I am wrong on that...

View solution in original post

4 Replies

Avatar

Correct answer by
Employee

Hi Sanmeet,

I believe this function is used for clickmap.  It is a callback to get the unique ID of the link.  When it is called, the parameter "o" refers to the anchor tag (i.e. <a href="http://adobe.com/"></a>).  So, o.href refers to the href attribute/property of the anchor tag.  Anyone correct me if I am wrong on that...

Avatar

Level 4

Thank you very much buddy. Appreciate the gesture. Please help me understand it further -

 "So, o.href refers to the href attribute/property of the anchor tag"

Here o.href refers to which anchor tags? Since, I am not explicitly mentioning the name of the anchor tag.

Thanks!

Avatar

Employee

Sure thing.  

When you put tracking on your pages and you enable click map, the code will basically say, "Give me all links on the page (i.e. give me all anchor tags on the page), then loop through each of them and pass them each individually through the function s_getObjectID to get the ID that I should use to track clicks on that link."  So, for each anchor tag (link) on the page, it will be passed through that function s_getObjectID and return an ID to be associated with that link for tracking purposes.  

Does that make more sense?