Search code examples
c#asp.net-mvcadsense

How can I add AdSense code to my ASP.NET MVC site?


I am setting up AdSense to my web application. I was given an AdSense code to paste into the HTML of my website, between the and tags. But I am using ASP.NET MVC for the website. Please, how do I go about using this AdSense code on my website?

<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>
   (adsbygoogle = window.adsbygoogle || []).push({
   google_ad_client: "ca-pub-5888633898042518",
   enable_page_level_ads: true
 });
</script>

Solution

  • Just add it to your _Layout.cshtml file, on the head tag.