How do I add Adsense snippet to Dash app?

Trying to incorporate Google Adsense. Saw some forums that had some answers but they are outdated. Anyone have any idea?

I’d use the app.index_string here in: Put the script tag right under the title tag, worked for me.


so I did that but still doesn’t work when I tell adsense I’ve added to my website, did you need to do anything else?

Hmm, that seems to have worked for me. Can you see the script when you inspect your page/is it at the right URL for Adsense?

I was able to get it to work using your suggestion. What I needed to do is make sure the custom html is at the top of the app script.


Use @ and select the user to send a message to a specific one.

1 Like

I am still confused and couldn’t figure out how to add the adsense snippet to the app.index_string can you show me a minimal example

Hi there, could you provide your code snippet? I got mine to run with the adsense but im weary of deploying without checking my work first. Thank you!

Hi @dck255 it is not working for me, can you provide your code snippet? Thank you so much!

Hi @TTYL , maybe this can help…

Do you all get this to work?

I have added adsense script in app.index_string as suggested, but no ads visible.

When I inspect the app/webpage it seems like adsbygoogle.js is running, but no visible ads.
Hope you have any tips, this is driving me crazy.