How to add javascript code at the end of the body of some pages

Hi,

I am trying to integrate with Firebase and it needs me to add some javascript towards the end of the body tag. How do I achieve it? Also, I want to do it on some pages only and not on all.

I tried adding an HTML element and added the code to it, but I can’t see it in the “view source” of the page, so not sure if it got added. How to verify that?

Please advise.

Thanks,
Mukesh

Did you ever figure out how to do this?

So, the reason a provider will tell you to add a script just below the closing body tag is because that script references some element in the DOM that it tells you to provide.

Which basically means that the script should be run after page load. So, you can use my LOADERR plugin for that (but it doesn’t let you provide plain text for your script, so just upload the script in question to Bubble’s CDN and use the URL from there). How do you upload some random script to Cloudfront? Just do this: Does Bubble use the unpkg CDN? - #8 by keith and then you can use that URL in LOADERR.

Plugin page for LOADERR: LOADERR: Load JavaScript Libraries Plugin | Bubble

1 Like

You could also load such a script after page load using GTM or any other solution, but you still owe me a tip here: https://gurpz.com/karma/

1 Like

I keep getting connection error when i try and give you a tip! Not to take over the thread but One last question I’m trying Avant links ALE to run via this javascript code it takes certain URLs and turns them into affiliate links if there corresponding. Any chance you would know why its not working?

Here’s the instructions
Copy this code into your site-wide html template, for example the ‘template.php’ or ‘footer.php’ pages. This will then be present on ALL of your pages on your website. Alternatively, if you only want to deploy it on some pages or specific pages, you can insert that code into the html of the web page(s) where you would like all your links encoded.

<script type="text/javascript" src="https://www.Redacted"></script>

Because like a doofus I made a typo in my own URL! Derp… GRUPZ: Karma-Ware Plugins for Bubble

For that type of script just add it to the page header for any page you want it (there’s also an option to add a script to all pages in your app’s settings).

Note that this feature is only available in paid plans and will silently fail on free plans… hence LOADERR.

Hmm added to the page html header didn’t seem to work I’m on the professional plan wonder if something on there side. You should have received a pack of smokes

1 Like

What’s your ACTUAL script URL? You “redacted” it in your original reply. If you put that actual URL in your browser, does anything appear?

The documentation you shared is VERY old fashioned. Are you sure the thing you’re trying to use even exists anymore?

Additionally, just loading a script doesn’t necessarily make anything magically happen. This sounds like some script where then you execute some other code.