Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

this.getAttribute is not a function

Avatar

Avatar
Give Back
Level 2
keithb81089125
Level 2

Likes

6 likes

Total Posts

23 posts

Correct Reply

1 solution
Top badges earned
Give Back
Validate 1
Establish
Affirm 1
Boost 5
View profile

Avatar
Give Back
Level 2
keithb81089125
Level 2

Likes

6 likes

Total Posts

23 posts

Correct Reply

1 solution
Top badges earned
Give Back
Validate 1
Establish
Affirm 1
Boost 5
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
Coach
MVP
Andrey_Osadchuk
MVP

Likes

509 likes

Total Posts

917 posts

Correct Reply

243 solutions
Top badges earned
Coach
Contributor
Seeker
Bedrock
Boost 500
View profile

Avatar
Coach
MVP
Andrey_Osadchuk
MVP

Likes

509 likes

Total Posts

917 posts

Correct Reply

243 solutions
Top badges earned
Coach
Contributor
Seeker
Bedrock
Boost 500
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)