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
Bedrock Mission!

Learn more

View all

Sign in to view all badges

(Firefox) Cannot send beacon: TypeError: document.body is null

Avatar

Level 1

Hi, 

I've just updated Firefox to the newest version, and I get the error above when loading my website with Launch deploying the Analytics extension (based on OneTrust consent management).

This error prevents the beacon to be sent.

It looks like the error comes from the last line of the main Analytics (_satellite) JS library.

 

Anyone experiencing the same ?

 

7 Replies

Avatar

Community Advisor

Could you share the website where this error is happening?

Avatar

Community Advisor

Hmm, I don't see that error. I'm using Firefox 104.0.1 in a private window with "Standard" Enhanced Tracking Protection.

did encounter another error when I first accepted all cookies in the consent banner:

yuhuisg_0-1662692864724.png

This error is coming from https://scripts.psyma.com/layer.php?xmlPath=abuk/abuk25_genesis, where the code is apparently incomplete.

yuhuisg_1-1662692916725.png

Can you upload a screenshot showing your error?

Avatar

Level 1

Thanks for asking. Here is the screenshot showing the error (this comes from https://www.genesis.com/ch, same website but different country):

 

Screenshot 2022-09-15 at 13.45.17.png

Avatar

Community Advisor

Sorry, I still don't see the error in Firefox (in a private window).

yuhuisg_0-1663316759614.png

 

Having said that...

I found custom code in your AA extension in your Launch library that contains "document.body". It looks like that code is from the getPercentPageViewed plugin from Adobe. Furthermore, I noticed that this is not in a s.doPlugins code block. (Ref: https://experienceleague.adobe.com/docs/analytics/implementation/vars/functions/doplugins.html?lang=...)

As a  result, I think your browser is running that code even before your browser has actually rendered the page properly, thus throwing the error about document.body being null.

Try adding your code in s.doPlugins properly, and see if you still get the error.

Avatar

Level 1

Thanks for getting back. Wrapping it in s.doPlugins is fixing the error, but I have some collateral effects, so I ended up running my plugin code (making use of document.body) in a rule instead of the custom extension editor. In addition, I conditioned the plugin code if document.body exists. This works fine.

Thanks!