# Inserting a custom script after Header

**URL:** <https://meta.discourse.org/t/inserting-a-custom-script-after-header/159438>\
**Category:** Product Support\
**Created:** [July 31, 2020, 5:20pm UTC](https://meta.discourse.org/t/inserting-a-custom-script-after-header/159438 "2020-07-31T17:20:04Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![AntiMetaman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/antimetaman/32/186978_2.png) [@AntiMetaman](https://meta.discourse.org/u/AntiMetaman)\
**Post date:** [July 31, 2020, 5:20pm UTC](https://meta.discourse.org/t/inserting-a-custom-script-after-header/159438/1 "2020-07-31T17:20:05Z")

</div>

Hi guys,

I already have the official discourse ad plugin working for me and showing ads on my site. The question is what if someone wants to place any custom script or ad that isn’t any of the ones that are built-in with Discourse?

I tried going to customize-\>theme-\>edit html/css-\>after header. I pasted a script this script block there and reloaded my site but I don’t see it. In fact, the only time I can see it is if I put it in the which causes the ad to appear at the very bottom of the page. The “After Header” however is the best position and it doesn’t load. Mind you, there is the `async` in this script.

I mean why do we need a complicated plugin to simply copy paste an html block? Even Google gives you their script and you can simply copy paste it after the header. This is what people normally do for websites, but it doesn’t seem to work for Discourse because something is blocking the script. It’s not CSP since I have `https:` and `inline-code` already as filters which already should allow every js that starts with “htttps”. Here’s a google ad:

```plaintext
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Ad 1 -->
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-3368174556925488"
     data-ad-slot="4362547659"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>

```

Try to make that above code work manually without using the Adsense plugin and place it in the theme after the header.

#plugin:advertising

Update: Apparently, the answer was House Ads. However, even when posting some scripts in House Ads, those ads don’t show up so Discourse is blocking something since if I post the same script on any html page, it will show up.

> [@House Ads in the official Ad Plugin](https://meta.discourse.org/t/house-ads-in-the-official-ad-plugin/116715):
>
> warning IF YOU ARE RUNNING AN AD BLOCKER RIGHT NOW YOU WILL HAVE A VERY BAD TIME TRYING TO SET THIS UP! TURN IT OFF BEFORE PROCEEDING DOWN THIS PATH! You’ve been warned. dragon Also be aware of browsers with built-in ad-blocker functionality (eg. Brave) I’ve been working on adding support for house ads in the ad plugin and would like some feedback about how you’d use it. Here’s a video to demonstrate how I have it working now: You define a set of ads using html and the usual theme…

---

_[View the full topic](https://meta.discourse.org/t/inserting-a-custom-script-after-header/159438)._
