How to Display Google AdSense in Joomla

How to Display Google AdSense Ad Units

Many of you asked us about the best way to place Google ads on your Joomla sites. If your Joomla site is published and already has some content, you have an opportunity to monetize it with Google AdSense ads.

You have two options:

  1. Let Google place their ads on your site automatically. In Google Ads interface this option is called "Auto ads".
  2. Create ad units by yourself and then manually place them throughout your site as you see fit, unit-by-unit.

We previously wrote about how to use "Auto ads". In this blog post, you will learn how to display ad units manually.


Create a Google AdSense account

click get started

This will bring you to the Google AdSense Sign-up page. 

  • Enter your site URL.
  • Enter your email.
  • Click either "Yes" or "No", depending on whether you would like to receive suggestions from Google AdSense. 
  • Click "SAVE AND CONTINUE":

click save and continue

  • Enter your payment address details. Visit the "Enter your payment address details" page for detailed instructions.
  • Verify your phone number (Not required in all countries.). Visit the "Verify your phone number" page for detailed instructions.
  • Now visit your Google AdSense Home page. You might see the "Earnings at risk - You need to fix some ads.txt file issues to avoid severe impact to your revenue." message at the top of the page, as on the image below:

fix the ads txt file issue

  • On your "Earnings at risk..." error message, click "FIX NOW":

click fix now

  • You will see the "Create an ads.txt file" box appeared. Click "DOWNLOAD":

click download

  • Download the ads.txt file.
  • FTP the ads.txt file to the root folder of your Joomla site:

ads txt file ftped

  • Allow Google AdSense some time, from a day to a few weeks, to find your ads.txt file. You will know that Google AdSense now recognizes your ads.txt file when you stop seeing the "Earnings at risk ..." message in your Google AdSense account Home page:

no error message displayed

Once this message has gone, you are ready to place the Google AdSense ad units within the content of your Joomla site.


Create ad units

  • In your Google AdSense account, click "Ads":

click ads

  • Click "By ad unit":

  • Click "Display ads":

click display adds

  • Create a descriptive name for your Google AdSense ad unit. As you can see on the screenshot below, I called my testing ad "Alex Test Ad Unit 01":

give your ad unit a name

  • On the right side of the screen, leave the default "Responsive" option as is and click the blue "Create" button:

click create

  • You will see the ad unit code snippet displayed. Click "Copy code snippet":

click copy code snippet

  • Download the "Sourcerer" Joomla plugin from ReguarLabs.com and install it on your Joomla site.
  • Open a Joomla article where you would like to display the ad unit. 
  • At the bottom of the screen, click the "Code" button:

click the code button

  • You will see the "Code" box. Paste the code snippet of your Google AdSense ad unit inside the "Code":

paste the code snippet

  • In the top left corner of the box, click the "Insert" button:

click the insert button

  • You will see the code snippet inside the text of your Joomla article:

the code snippet inside the text of your joomla article

  • Click "Save" or "Save & Close" to save your edited article with the Google AdSense add.
  • Allow a few minutes and then check your Joomla article at the frontend of your site. You should now see the Google AdSense ad unit displayed, just as you intended:

the google adsense ad unit displayed


What's Next?

Save $1000's when you sign up to Joomlashack's Everything Club.

You will get access to all our 31 extensions, templates, and Joomla training.

  Click here to join the Everything Club


About the author

Alex is a self-taught Microsoft Certified Professional based in England. He enjoys learning Joomla and helping beginners and web site administrators make the most of it.