How to Add Google AdSense Auto Ads to a Joomla Site

How to Add Google AdSense Ads to a Joomla Site

A few customers recently asked us about how to add ads from Google AdSense to their Joomla sites. If your Joomla site is live and has some content, you have an opportunity to monetize it by displaying ads from Google AdSense.

You have two options to display ads:

  • Allow Google to place their ads on your site automatically. This option is called "Auto ads".
  • Create ad units yourself and manually place them throughout your site as you see fit, unit-by-unit.

Our blog post "How to Display Google AdSense Ad Units" discusses ad units. In this blog post, I'll show you how to place Google AdSense ads automatically.

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

  • Install Shack Analytics Pro on your Joomla site.
  • In your Google AdSense account, go to "Ads" > "Overview" > "By site" and click "Get code":

click get code

  • You will see a modal box with the code snippet. Click the "Copy code snippet" button and then click "Done":

click the copy code snippet

  • In your Joomla administrator panel, go to "Components" > "Shack Analytics Pro".
  • You will be taken to the "Shack Analytics: Tracking Tags" screen. In the top left corner of the screen, click "New":

click new

  • You will see the "Shack Analytics: New Tracking Tag" screen. Give the new tracking tag a name in the "Title" field. Paste the code snippet you copied in your Google AdSense account into the "Header custom code" box:

create title paste the code snippet

  • Click "Save" or "Save & Close". 

You will see your newly created tracking tag listed:

new tracking tag listed

Good job! Now let's use this tracking tag with the code snippet from Google AdSense to place this code between the <head> and </head> tags of your Joomla site.

  • In the top right corner of the "Shack Analytics: Tracking Tags", click "Options":

click options

  • This will bring you to the "Shack Analytics: Configuration" screen. Under the "Shack Analytics Pro" tab, click inside the "Global Tracking Tag" box and select your Google AdSense tracking tag.
  • Click "Save" or "Save & Close".
  • Now check the HTML source code of your site. You should see the tag's code snippet between the <head> and </head> tags:

the code snippet inside the source code

Excellent! Your Joomla site is now connected to your Google AdSense account.

  • 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 Google AdSense auto ads within the content of your Joomla site. Here are the advantages of using "Auto ads" according to Google AdSenseHelp:

  • They potentially increase your revenue. Auto ads analyze your pages and find new places to show ads based on your layout, content, and existing Google ads.
  • They're easy to use. You only need to place one piece of ad code to get started. After you've placed the code, Auto ads will automatically adjust to any changes you make to your site and your ad settings.
  • They let you tailor ads to your site. Auto ads settings give you control over where ads appear on your site.
  • They're mobile friendly. Auto ads automatically adjust to every screen size. They also include mobile-exclusive formats such as anchor ads and vignettes.

Now is a good time to turn on the "Auto ads" in your Google AdSense account.

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

click ads

  • Make sure you have the "By site" tab open:

make sure you are on the by site tab

  • At the bottom of the screen, click on the little pencil icon:

click on the pencil icon

  • You will be taken to the "Ad Settings Preview" screen. At the top of the right side of the screen, on the "SITE SETTINGS" section, click the "Auto ads" toggle:

click auto ads

  • Notice that the toggle's color changed from gray to blue:

the toggle changed color

  • Also, notice the "Auto ad example" appeared in your site preview:

auto ad examples

  • Go once again to the "SITE SETTINGS" and click the "Apply to site" blue button:

click apply to site

You will be taken back to the "By site" screen. You will see the status of the "Auto ads" now changed from "OFF" to "ON". You will also notice the "Success!" message stating that it may take up to one hour for Google AdSense to start displaying ads on your site:

the up to an hour message

  • Check your Joomla site in about an hour. You should eventually see Google AdSense ads.

They may appear on your home page:

ad on a home page

You should also see them in deeper pages, for example, in your blog:

ad in blog

What's Next?

Save $1,000's when you sign up to Joomlashack's Everything Club.

You will get access to all our 32 extensions, and legendary support!

  Click here to join the Everything Club

About the author

Steve is the CEO of Joomlashack. Originally from the UK, he now lives in Sarasota in the USA. Steve has been involved with Joomla since 2006.