Many ad networks, including AdSense, are asking publishers to add their credentials to an ads.txt file. This verifies that the ad network is allowed to sell ads on your website.
Advanced Ads allows you to manage the content of your ads.txt file and even generates one automatically when AdSense is enabled through the plugin.
Table of Contents
You can find the ads.txt options in Advanced Ads > Settings > General > ads.txt.
ads.txt on WordPress
The option to generate an ads.txt file is enabled by default. This would make the file accessible under the following conditions:
- the site is hosted on a top-level and not in a subdirectory or subdomain (e.g., example.com works, but not dev.example.com or example.com/dev).
- the AdSense publisher ID is saved in Advanced Ads > Settings > AdSense or additional content is given in the ads.txt content field in Advanced Ads > Settings > General > ads.txt.
- if Advanced Ads recognizes a third-party ads.txt, it offers you to import the entries and replace the file
When the requirements are met, you should be able to access your ads.txt in the root directory of your site, e.g., example.com/ads.txt.
The file should contain the correct value of your AdSense account as well.
The file generated by Advanced Ads starts with
# Advanced Ads ads.txt, making it simple to check if it is really generated by our plugin.
Example of an ads.txt for AdSense
Let’s take a look at an example of the ads.txt record for a normal AdSense account:
google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0
You can copy the example from above and only need to replace pub-0000000000000000 with your own publisher ID to get the valid record for your ads.txt. Advanced Ads will create the ads.txt file with the correct data for AdSense automatically. Just connect with your AdSense account or add the AdSense publisher ID in Advanced Ads > Settings > AdSense.
If you can open the file in
yourdomain.com/ads.txt, everything is fine. You can just close the warning about the missing ads.txt in Advanced Ads now. AdSense will come and check it within a few days.
ads.txt on a multisite
Only one ads.txt file is needed on a multisite. It needs to be hosted on the top-level domain and not in a subdirectory or subdomain.
The main blog will contain an option to Generate a single ads.txt file for all sites in the multisite network.
This will generate an ads.txt file with all information from all subpages (needs WordPress 5.1).
Advanced Ads imports warnings from AdSense. If you created your ads.txt, then just close the notification in the Advanced Ads dashboard. AdSense might need some days to check for the file and will remove the warning automatically when they did.
Advanced Ads does only create the link to the ads.txt file when you enable that feature and either enter content in the ads.txt settings in Advanced Ads > Settings > General > ads.txt or when the AdSense publisher ID is added.
Please clear your browser cache and reload the ads.txt link. If this does not help, please check if you have caching plugins installed, that might delay changes in the ads.txt.
If the ads.txt does not show # Advanced Ads ads.txt at the top, then the file is not generated by Advanced Ads and either exists already physically in the root directory of your website or another plugin overrides our settings. You must find the source and remove it to use the Advanced Ads ads.txt feature.
An error occurred: cURL error 51: SSL: no alternative certificate subject name matches target host name XYZ
If you see the error above, then your SSL certificate is set up wrong. Please contact your web hosting or review the SSL settings to resolve this.
What else you might want to know
- Developers can include their content to the ads.txt file generated by Advanced Ads using the advanced-ads-ads-txt-content filter.
- Advanced Ads does not generate a physical ads.txt file. So you won’t be able to see it using FTP.
- Other plugins may be overriding our ads.txt. You must then use either their ads.txt feature or ours.
- Ads.txt for WordPress – the Ultimate Guide for AdSense
- See the AdSense manual for more information about ads.txt files for AdSense and crawling issues