Det är viktigt att skydda din WordPress site från Advertising-bedrägerier, men det behöver inte vara komplicerat. Filen ads.txt är ett enkelt men kraftfullt verktyg som kan skydda dina annonsintäkter och ditt rykte.
Vi har varit en del av WordPress-communityn i över ett decennium och hjälpt webbplatsägare som gillar you att navigera i komplexiteten med online Advertising. Gång på gång har vi sett hur implementering av en ads.txt-fil kan göra en verklig skillnad.
I den här guiden kommer vi att gå igenom två enkla metoder för att skapa och hantera en ads.txt-fil i WordPress.
Varför skapa och hantera Ads.txt-filer i WordPress?
Ads.txt är en förkortning för ”Authorized Digital Seller”. Det är en fil som visar vilka företag som är approve för att sälja annonser på din WordPress website och hjälper till att stoppa falska annonser från att visas.
Om du tjänar pengar på att blogga från annonser (gillar med Google AdSense), är det en bra idé att add to en ads.txt-fil till din website.
Anledningen är att vissa obehöriga parter kan låtsas ha din behörighet att sälja annonser på din WordPress blogg. Detta kan leda till att dåliga eller vilseledande annonser visas, vilket kan vara farligt för ditt rykte och dina användares säkerhet.
Filen ads.txt är som en vakt. Den stoppar alla som ej finns på din approved-lista från att sälja annonser på din WordPress blogg. På så sätt säkrar du din website och ser till att endast annonser från betrodda partners faktiskt visas.
Med detta i åtanke, låt oss se hur du kan skapa och hantera en ads.txt-fil i WordPress. Vi kommer att gå igenom två olika metoder för dig. Du kan använda dessa snabblänkar för att hoppa till en specifik metod:
Metod 1: Skapa en Ads.txt-fil i WordPress med hjälp av WPCode (rekommenderas)
Att skapa och hantera en ads.txt-fil kräver lite kodning. Om du inte är bekväm med att lägga till customize-kod på egen hand, kan den här processen verka överväldigande.
Det är därför vi rekommenderar att du använder WPCode, som är det bästa code snippet tillägget på marknaden. Med detta behöver du inte direkt pilla med din WordPress-kod och oroa dig för att din website ska gå sönder.
Detta plugin fungerar som ett användarvänligt gränssnitt där du enkelt och säkert kan infoga custom code i din WordPress website. You can view all the codes you’ve added in one place so that you can keep track of your customizations.
För den här guiden kommer vi att använda WPCode Pro-versionen. Det finns ett gratis WPCode plugin, men den funktion vi behöver för att hantera ads.txt-filer finns i Pro-versionen.
Först och främst, gå vidare och installera WPCode. Du kan följa vår Step-by-Step guide om hur man installerar ett tillägg till WordPress om du behöver lite vägledning.
Se sedan till att aktivera WPCode Pro license key. Gå bara till Code Snippets ” Settings och insert din license key där det är lämpligt. Välj sedan knappen ”Activate Key”.
Du kan se att aktiveringen är utan problem när texten på knappen ändras till ”Deactivate Key”.
Nu, låt oss gå till Code Snippets ” File Editor. Här kommer du att se att plugin redan har en built-in ads.txt manager funktion.
Det du behöver göra nu är att skriva följande information i det här formatet: domän, publicerat ID:n, relationstyp och ID:n för publiceringsplattformen (valfritt).
Här lägger vi till exempel till Google AdSense som en approved advertising platform:
google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0
Det första fältet är domänen för det företag som har tillåtelse att sälja eller återförsälja ditt annonsinventarium. I exemplet ovan är det Google.com.
Efter det addar du till publisher ID:n, som är unik för your account. Här är det pub-0000000000000000. Om du inte är säker på var du hittar detta ID kan du kontrollera nätverkets eller plattformens online-dokumentation för mer information.
Se till att ID:n blir rätt. Otherwise, you may face the ”Earnings at risk” error.
Den tredje sectionen deklarerar relationstypen, som är antingen DIRECT eller RESELLER. Direct innebär att publiceraren arbetar direkt med AdTech-leverantören.
Återförsäljare innebär att publiceraren har auktoriserat en tredje part att sälja för deras räkning, till exempel ett annonsnätverk eller en lösning för annonshantering.
Det sista fältet är ID:n för reklamplattformen, vilket är valfritt.
Du kan nu add to så många plattformar och återförsäljare som du vill. Se bara till att lägga till varje organisation på en egen rad.
När du är klar rullar du bara ner och clickar på ”Save Changes”.
Nu kan vem som helst läsa din sites ads.txt-fil.
För att se filen i action, add helt enkelt ads.txt till slutet av ditt domain name, till exempel www.example.com/ads.txt.
Metod 2: Skapa en Ads.txt-fil i WordPress med hjälp av Ads.txt Manager (gratis)
Ett annat sätt att skapa en ads.text-fil är genom att använda Ads.txt Manager. Detta gratis plugin lägger till en enkel code type editor där du kan skriva in alla dina auktoriserade plattformar och nätverk.
Det första du behöver göra är att installera och aktivera pluginet Ads.txt Manager. För mer detaljer, se vår Step-by-Step guide om hur du installerar ett WordPress plugin.
Efter aktivering, head över till Settings ” Ads.txt page.
Detta öppnar en enkel kod editor där du kan lägga till varje plattform eller återförsäljare detaljer på sin egen rad, precis som tidigare.
När du är nöjd med den information du har enter klickar du på knappen ”Save Changes”.
Hur man fixar Earnings at Risk Error i Google AdSense
Om du använder Google AdSense finns det en chans att du kan se följande error i ditt AdSense account:
Intäkter i riskzonen - En eller flera av dina ads.txt-filer innehåller inte ditt AdSense-utgivar-ID. Fixa detta nu för att undvika allvarlig påverkan på dina intäkter.
Det betyder bara att din ads.txt-fil inte har rätt ID:n för publiceraren.
För att fixa detta problem, logga in på din AdSense page med din Google email address och password. Du hittar ID:n bredvid följande fält: ”This email is associated with the AdSense account.
Nu går du bara till WPCodes File Editor eller Ads.txt-hanteraren och hittar raden som lägger till Google AdSense som en auktoriserad provider. Ändra sedan texten så att den använder rätt ID:n.
Därefter sparar du din ändring för att lagra dina settings. Nu, om du besöker ditt Google Adsense-konto igen, borde error-meddelandet ha försvunnit.
Maximera din potential för WordPress Advertising
Vill du ta din WordPress-annonseringsstrategi till nästa nivå? Kontrollera dessa användbara resurser:
- Så här infogar duAds i ditt post-innehåll i WordPress – Lär dig hur du strategiskt placerar annonser i ditt content för maximal synlighet och engagement.
- Så härskapar du en website för radannonser med WordPress – Upptäck hur du skapar en blomstrande plattform för radannonser med WordPress.
- Så här visar du annonser endast för besökare från sökmotorer i WordPress – Rikta dina annonser mer effektivt genom att visa dem exklusivt för besökare från search engines.
- Så här ökar du annonsvisningar i WordPress med Ad Refresh – Öka dina annonsintäkter genom att implementera tekniker för att uppdatera annonser i WordPress.
- How to Display Ad Blocks in Specific Posts in WordPress – Lär dig hur du customize dina annonsplaceringar genom att visa specifika annonsblock på valda posts.
Vi hoppas att denna tutorial hjälpte dig att lära dig hur du skapar och hanterar ads.txt-filer i WordPress. Du kanske också vill lära dig hur du hanterar annonser i WordPress med AdSanity-pluginet och vår lista över de mest utförda Google Adsense-bannerstorlekarna.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
Jiří Vaněk
I was also initially alerted that I didn’t have an ads.txt file. However, I eventually chose the path of manually creating and uploading it via FTP to save WordPress from additional plugins. Therefore, I recommend the same. Alternatively, if anyone has a file manager in WordPress in the form of a plugin, they can simply create a text file named ads.txt with the code and upload it to the root directory of WordPress via FTP.
Ahmed Omar
I just received this message few days ago ”Earnings at risk – You need to fix some ads.txt file issues to avoid severe impact to your revenue.”
This post solved my issue
Thank you
WPBeginner Support
Glad our recommended solution helped
Administratör
Amber
Hi,
I have followed the steps to add the ad.txt to the website. When I go to check it is says page not found. I have deleted cache. I’m not sure what else to do.
WPBeginner Support
If clearing your site’s cache is not working, reach out to your hosting provider for them to make sure it is not their caching or a security setting that may be preventing it from being crawled.
Administratör
Poornapragna G A
Hi,
I have been a regular reader of your lovely blog. Thanks.
I entered the details of Ads.txt as given in Google Adsense in the Ads.Txt section ”Settings” section in the WordPress dashboard and saved the changes as per your guidance above. Still, my Adsense account says ”Ads. Txt not found”. What is the reason for this?
WPBeginner Support
If you have any caching on your site, ensure that you clear it as that is the most common reason why Google would not be able to find your new ads.txt.
Administratör
Ismail
Will this ” f08c47fec0942fa0″ be unique to all advertisers in my website?
WPBeginner Support
Yes the ad code will be specific to the advertisers
Administratör
Caydaruus
Hello i installed Manage Ads.txt and i have google adsense and taboole my question
can i use both in this plugin in one place
WPBeginner Support
Unless we hear otherwise, you should be able to add both using this plugin.
Administratör
Rakesh
Very nice article but I want to know how I can add more than one ads.txt file in root folder of my domain , lets say one from google and other from infolink? Please help
WPBeginner Support
You should be able to add the information from one ads.txt file to the other and merge them for what you’re wanting to do
Administratör
Poorna
You guys makes everything so simple! Thanks a million!! I just uploaded Ads.txt file into my site!!
Arif Wali
Hello,
I have installed more than 10 plugins I don’t want to install more than that. I there any alternate option?
WPBeginner Support
You would need to manually edit your ads.txt file using FTP or your host’s file manager but for your worry of how many plugins, we would recommend taking a look at our article below:
https://www.wpbeginner.com/opinion/how-many-wordpress-plugins-should-you-install-on-your-site
Administratör
Jem
Followed everything but when time to check it appears cannot be found. what should I do?
WPBeginner Support
If you do not have an ads.txt file then you can create one, not all sites have one created for them by default.
Administratör
Sasindu Jayasri
I worked with infolink before with this plugin. It worked properly. Now got adsense approval too. So need to add adsense ads.txt code to here. Without losing infolink can I add that file too?
WPBeginner Support
You would add the new information on a new line of your ads.txt file.
Administratör
Emmanuel Acquah
I do want to insert ads text on my wordpress website and will this work or is there any other recommendation to carry out this action.
WPBeginner Support
You would want to check with who you are wanting to include ads from for how to add those to your site. This guide is to help limit what can include ads on your site rather than adding more to your site.
Administratör
mohamed salah
i have added ads.txt from google adsense, and now i need to add ads.txt from another site and in file manager it refuses to create another ads.txt file, what can i do ?
WPBeginner Support
Rather than creating another, you would want to modify your ads.txt with the recommendations from the different platforms you want to include.
Administratör
Bhuvana M J
Thanks, it is very helpful
WPBeginner Support
You’re welcome
Administratör
Paula
Very helpful, the plug-in was very easy to install and use.
One question: now that my Ads.txt file is installed and running smooth on my site, is it okay to delete the plugin? Or would doing that also delete the Ads.txt file? I ask only because I try to minimize the number of plugins on my site, since each extra plugin makes the site that little bit heavier/slower etc.
Thanks again.
WPBeginner Support
You would want to check with the plugin’s support for how they handle that currently but for how plugins affect your site speed, we would recommend taking a look at our article below for a better understanding:
https://www.wpbeginner.com/opinion/how-many-wordpress-plugins-should-you-install-on-your-site
Administratör
Carmen Applegate
Wow! I’ve been trying to figure this out for almost an hour now! This article totally saved me! Thanks!
WPBeginner Support
Glad our article was helpful
Administratör
WILLIAM
This page has saved my bacon on more than one occasion, thank you.
WPBeginner Support
You’re welcome, glad our guide could assist you
Administratör
Stephen Reeves
Hey there,
I am getting an error regarding there already being an ads.txt file on my wordpress, although there shouldn’t be? Strange.
WPBeginner Support
You may want to check with your hosting provider to ensure there was no hiccup from their end.
Administratör
Rakib
Thanks For share with us it”s Very helpful for beginner.
Thank You a lot !!!
WPBeginner Support
Glad you found our content helpful
Administratör
Ashish Gupta
Thank for sharing the article, i,m also facing the same issues.
I just want to know that, i have to update same code or need to do any change.
google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0
WPBeginner Support
You need to replace the pub-0000000000000000 with your own publisher ID
Administratör
Vana
Always helpful, always to the point, thats why any time I need help I use wpbeginner.
Thank you so much!
Vana Verouti
WPBeginner Support
Thank you, glad our content can be helpful
Administratör
Karnav
If i upload txt file in file manager on my control panel instead adding new plugin compare to add a plugin and put code in it, would it have same speed for loading my website or is it that plugin based set up affect the speed?
WPBeginner Support
The speed difference shouldn’t be noticeable between the two methods
Administratör
Mae Orcales
Thanks, you’ve always been a great help!
WPBeginner Support
Glad our guides have been helpful
Administratör
Samson
My team and I just got our AdSense approved. We installed the Ads.txt plugin but I noticed all our articles had a change in their URLs.
On tracing it, I saw that that ads.txt code of ”google.com, pub-account, DIRECT, blah blah blah” is being added to every of our post URL making it look like ”www.example.com/google.com, pub-account, DIRECT, blahblabhblah/post-name/
It really looks disturbing.
Please, how can I remove it without disturbing the ads.txt?
WPBeginner Support
The ads.txt shouldn’t modify your permalinks, you would want to start by checking your permalink settings under Settings>Permalinks to see what is set there as well as resaving your permalinks
Administratör
Swarupa...
wpbeginner,
You are a savior. You have answers to all my questions.
Thanks a lot
WPBeginner Support
Glad we can help answer your questions
Administratör
vuctor
i got approved, and i had the warning, i quickly installed and activated the plugin and the warnings disappeared. But days later, my ads stopped showing on my site (it wasn’t a ban or suspension). it just leaves blank ads spaces. The thing now is that the ads show sometimes, and most times it doesn’t which has made my earnings very poor.
WPBeginner Support
For what it sounds like, you would want to use Google’s ads not displaying troubleshooter to see if there are any issues, otherwise, it could be there are no recommended ads to match the content on your site.
Administratör
Francisca
Is there any way this can be done without a plugin?
WPBeginner Support
Yes, you would manually upload the ads.txt file to your site using either your host’s file manager or FTP and you could create the file using notepad or a similar text editor.
Administratör
Pardeep
Hey, I have added it like it states in this article, but when I go to google ad sense it says the same earnings at risk message. How do I resolve this?
WPBeginner Support
You may need to give some time for Google’s cache to clear so it recrawls your site
Administratör
Nikhil Kumar
Thank you so much. I had no idea why my ads had gone blank. After adding ads.txt everything is working fine.
WPBeginner Support
Glad our guide could help solve the problem
Administratör
Ajibade Victor
Nice article, really helpful but will the Ads.txt plugin be automatically added to my site’s root domain? i mean, it seems really simple. Are you saying all i need to do i download the plugin, copy the google code, replace the pub id with mine and save changes. What about adding the txt file to the root domain? Will the plugin do that automatically?
WPBeginner Support
Yes, the plugin should create that file and place it for you
Administratör
Simon Pan
Thanks for your article
WPBeginner Support
You’re welcome, glad you like our article
Administratör
Dina
Hello,
We have 2 google adsense accounts how to add both of them. I add two lines :
google.com, pub-first-account, DIRECT, f08c47fec0942fa0
google.com, pub-second-account, DIRECT, f08c47fec0942fa0
or how ?
Thank you
WPBeginner Support
You’re correct, that would be how to add a second accepted advertiser on your site
Administratör
Nitesh
I am searching for this tactics long time. Thanks for sharing with us.
WPBeginner Support
You’re welcome, glad our article could be helpful
Administratör
MicroDok
Thanks for your article. I was able to add Ads.txt on my website using the plugin recommended. But, Google Adsense is still not showing on my website; its still blank as before. What could be the problem?
WPBeginner Support
There are a few possible reasons for ads not showing, if Google hasn’t recrawled your site that could be the simplest. Otherwise, you would want to go through their troubleshooter for the cause and fixing the issue.
Administratör
Emmanuel Peter
Thank you for your explanations. I was able to add Ads.txt on my website using the plugin recommended. But, Google Adsense is still not showing on my website. What could be the problem?
WPBeginner Support
The most common reason is either your site’s caching or if your robots.txt may be preventing the file from being crawled. Google does take time to recrawl your site as well.
Administratör
pawan
i hv domain and subdomain too, how can i fix this, as u hv been told it would work on main domain only.
WPBeginner Support
For the subdomains, you would need to manually create an ads.txt file and in your primary domain, note the subdomain for your site.
Administratör
Pawan
I hv 2 adsense, one for main domain and another for subdomain. Now I hv addeed txt file for main domain adsense only. Can i add both publishers id in one txt file.
WPBeginner Support
You could add both publisher ids to the ads.txt file but you would want to make sure the correct id is in the subdomain’s file.
Irfan Ahmed
Thanks. For a novice like me, you have been a great help in setting up my website.
The most important thing is that your information is always to the point, and trustworthy. Whenever I face any problem, I search on your website. And if I have found what I am searching for, I know that my problem will now be definitely resolved.
WPBeginner Support
Glad our guides could be helpful
Administratör
Belmadeng
Thanks for sharing this guide. It was really helpful
WPBeginner Support
Glad our guide could help
Administratör
Favour
The Plugin says; Untested with your version of WordPress, any other way?
WPBeginner Support
For that message, you would want to take a look at our article here for understanding it: https://www.wpbeginner.com/opinion/should-you-install-plugins-not-tested-with-your-wordpress-version/
Administratör
Ajay
Hii, nice information. I had applied this procedure but it was still showing the same message. What was the issue.
WPBeginner Support
If you just added the ads.txt then you would need to wait for Google to recrawl your site for the error to disappear.
Administratör
Philip
So done all of that and still showing in my adsense same warning. I am sure it will update soon and thank you for this simple to follow guide.
WPBeginner Support
Glad our guide could help
Administratör
Edem Buameh
Im geting errors with my site
Im told html corrupt after visiting
Please help
Ads are still not showing after 48hours
WPBeginner Support
you may want to try disabling any caching plugin on your site, if that resolves the issue you would want to exclude your ads.txt from your caching plugin.
Administratör
EDEM BUAMEH
Thanks for the advice
I’m no longer getting html corrupt after visiting the ads.txt
I went to exclude and entered the link above
I’m so grateful
I only hope my ads will start showing after 24hours
Thanks again
Cheers!
WPBeginner Support
Glad our recommendation could help
Jimy
Thank you very much. I thought I needed to ad another page to the site.
WPBeginner Support
Glad our article could help
Administratör
barbara
This was super helpful! Thanks!
WPBeginner Support
Glad our article could be helpful
Administratör
James Parry
Thank you, really helpful when I got a little lost in the process.
Amby
I did as instructed and two days later I’m getting the same warning from Adsense. :/
HENRY
Nice, i was looking for this plugin, so i do this..is easy. Thanks for the help.
Mani
I recently used ads.txt plugin to install ads.txt file to my website I made all the changes as instructed but still my ads.txt page is showing blank. Can you please check and revert ASAP or can I use another plugin to make things live?
Rajat Chakraborty
Is there a ’No-Plugin’ way of doing this thing.
Everytime there is an update for something, a plug-in pops up out of nowhere as a solution.
George
Bizarre that one would need a plugin for something so stupidly simple trivial!