this.getAttribute is not a function

Avatar

Avatar
Seeker
Level 2
keithb81089125
Level 2

Likes

6 likes

Total Posts

26 posts

Correct reply

1 solution
Top badges earned
Seeker
Engage 1
Give Back
Validate 1
Establish
View profile

Avatar
Seeker
Level 2
keithb81089125
Level 2

Likes

6 likes

Total Posts

26 posts

Correct reply

1 solution
Top badges earned
Seeker
Engage 1
Give Back
Validate 1
Establish
View profile
keithb81089125
Level 2

20-04-2021

Hi Community,

 

We recently migrated to Adobe Launch from DTM and we noticed that our links are now sending undefined values. When we did an investigation we noticed that when users click our buttons on the console we get back the following message.

Screenshot 2021-04-20 at 11.35.43.png

 

"this.getAttribute" is not a function.

I have searched the Adobe Launch best practices documents and there are no new updates around this. Please can you assist if you have experienced the same issue and managed to resolve it?

I am not sure if the new Launch TMS has stopped supporting Vanilla Javascript (raw javascript) for something else.

Thanks

 

 

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Shape 25
MVP
Andrey_Osadchuk
MVP

Likes

538 likes

Total Posts

973 posts

Correct reply

264 solutions
Top badges earned
Shape 25
Bedrock
Coach
Boost 500
Affirm 250
View profile

Avatar
Shape 25
MVP
Andrey_Osadchuk
MVP

Likes

538 likes

Total Posts

973 posts

Correct reply

264 solutions
Top badges earned
Shape 25
Bedrock
Coach
Boost 500
Affirm 250
View profile
Andrey_Osadchuk
MVP

21-04-2021

The Data Element "cust_linkName" is set up as a custom code as follows. It looks odd because:

1) the comment line is referring to the link while this DE is not fired on a link click. In other words, if this code was fired on link click, then it would work as expected, but since it's a regular data element the "this" variable is referring to the window object.

2) the usage of setVar will not work as it writes a custom variable with the name of the existing data element

 

I assume, that this custom code was supposed to be fired inside a Rule mapped to the Mouse Click event. The code will work either in Conditions or Actions, and if you want to use the cust_linkName custom variable, delete this data element first.

 

 

//*-* Set a custom DE to hold the link name globally
var data_id = this.getAttribute('data-id');
var data_text = this.getAttribute('data-text');
var data_intent = this.getAttribute('data-intent');
var data_component = this.getAttribute('data-scope');

//*-* Set virtual Data element 
_satellite.setVar('cust_linkName', data_intent + " | " + data_component + " | " + data_text);

return true;

 

 

Answers (0)