top of page
Search
Writer's picturePassivelyEarn.com

Fixing Ads.txt Error in Wix

This post describes in detail how to fix the ads.txt error in Google Adsense for those who own a Wix website. Follow these instructions exactly.

Once I was accepted into the Google Adsense program I was pretty excited; I could now make some ad revenue off my site. Or could I? I log into Adsense and it puts this red banner on the dashboard: "Earnings at risk - You need to fix some ads.txt file issues to avoid serious impact to your revenue"

The first thing all of us did was a web search, and it brings up fixes for everyone but Wix. Then you come across that one article that says "All you have to do is..." No, buddy, some of us don't know about all of this html stuff. It took a month, but I finally figured out how to get the error to go away. Let's get your ads.txt error fixed:


Step 1: Open your Wix editor for your website

Do it the same way you always do when you work on your website.


Step 2: At the top of the screen click on Dev Mode

This is where a lot of the really complicated stuff happens. Turn on Dev Mode and a new menu will open to the left. Look through the options until you find "Backend". Once you put your mouse over it a + will appear to the right. Click on the +.



Step 3: Create a new .js file

If it tries to create a .jsw file just remove the w while typing in the next part. You want the file to be named http-functions.js


Step 4: Get rid of all the crap

When a new http-functions.js page is made it comes pre-loaded with a bunch of html script. Delete it all. Yes, all of it.


Step 5: copy and paste this into the now empty http-functions.js file


import {ok, notFound, serverError} from 'wix-http-functions';

// @see https://www.wix.com/corvid/forum/community-discussion/adding-ads-txt-file

let adstxt = `google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0`

export function get_Adstxt(request) {

let options = {

"headers": {

"Content-Type": "text/plain"

},

"body": adstxt

};

return ok(options);

}


(Note: Be sure to replace pub-00000000000 with your publisher ID, we'll talk about that next)


Step 6: Find your Publisher ID

Go to your Adsense account, open the left menu and go down to Settings, then account, then account information. Your publisher ID will be the top entry. Copy and past that t oreplace the generic pub-00000000000 in the code above. Make sure you copy all the characters and delete all of the old zeros.



Step 7: Save and publish, then create a 301 redirect

Go to your site's dashboard. Click Marketing tools on the left, then click SEO Tools. Click + New Redirect, add a Redirect for /ads.txt to point to /_functions/Adstxt


Step 8: Check your ads.txt file

Type in your site address like this:

http://yourwebsite.com/_functions/Adstxt

and it should show a field that looks like (google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0) except with your publisher ID.


Step 9: READ THIS

You've fixed your ads.txt error. Take a moment to enjoy this.... because the next part sucks for some people. I have a small site that doesn't get much traffic; it took a month for the error message to go away in my adsense account. Yes, a month. It will work, just stick to your guns and do go messing with things.


Hopefully this will help anyone who has gotten the red error of doom, and If you liked this article you may be interested in my website, www.passivelyearn.com where I discuss making money online and ways of setting up passive income streams. I have a blog on the site that gets updated with helpful articles, and if you feel inclined I'd love for you to stop by and read a few!



6 views0 comments

Recent Posts

See All

Bing Rewards got even better!

For those of you considering Bing Search Rewards, now is definitely the time to get started or even pick back up the habit. The new...

Where are all the posts?

I started writing this blog to bring ideas about earning passive income from the internet to the forefront. Then the election happened....

Comments


bottom of page