Adding Ads.txt file

Hi,

I have a new blog that’s been up for a couple of months and would like to hook up an ads.txt file so that we can make a few cents to offset the work we’re putting into this. I asked for help via the support team but they told me to vote for a feature that did this and sent me here.

We’ve had an ads.txt file provided to us which should be able to found here https:///ads.txt , the same place as https:///robots.txt (though this in internally generated).

I’m at a loss for how to do this as I’ve looked for documentation on how and haven’t come up with anything.

Can anyone help and/or offer any insight on a direction to move in?

Much appreciated,
Jenny

4 Likes

Hi Jenny,
You can add a txt file to the public directly, however it won’t be integrated with your Wix Blog product. You can also post your request here .

Best,
Tal.

I’m looking to add apps-ads.txt to the root of our Wix website. Is this possible? I’m unable to find any clear answers on this and Tal, your above reply is fairly ambiguous. This is a .txt file for ad verification and needs to sit at the root. It’s not for “the public directly”. Can it be done with Wix?

Well I think I managed to get something that might do the trick using http-functions.
https://www.wix.com/code/reference/wix-http-functions.html

I got the idea from : https://www.wix.com/code/home/forum/community-discussion/database-6

And after completing the http-function to provide the content of the app-ads.txt file, you use a 301 redirect so that http://yoursitedomain.com/app-ads.txt will redirect to your http-function. It seems to be working for us!

Hi,

Just wanted to contribute to this thread and say thanks for pointing us in the right direction - - to help others who may potentially come across this stumbling block - here is what you need to do.

Create a file called http-functions.js in your Backend folder of files.

Then copy this template and add your own text:


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

// @see https://www.wix.com/corvid/forum/community-discussion/adding-ads-txt-file
let adstxt = # Ads.txt Add text here...

export function get_Adstxt(request) {
let options = {
“headers”: {
“Content-Type”: “text/plain”
},
“body”: adstxt
};
return ok(options);
}


You will then be able to access it on your site at eg. Fastest Web Hosting Services | Buy High Quality Hosting

For the final step (you must do this) - in your settings - add a Redirect for /ads.txt to point to /_functions/Adstxt

Then ad networks will find your file correctly - job done.

1 Like

Hi everybody,

Actually I think I have the same issue of you, meaning that I should host an Ads.txt file at the root level of my domain. The problem that I have no clue how to do it with Wix, and honestly speaking also what you mentioned above, being not an expert of website and similar, doesn’t sound so understandable.
Would it be possible from Wix Team to have a detailed and easy step by step guideline to help us?

Thank you very much in advance for the help!

Hey Everyone,

Are you able to find a solution of it?
I’ve tried it myself, as suggested by Jason, and it seems to work from my end. I am not sure if this is the correct method, or it will be applicable for the Ads Network to check it, But right now it is working. You can check my website here.
https://www.avnishparker.com/ads.txt

In case you need a detailed Tutorial, I’ll be happy to make one.

Thank you!!!

Jason is on the right path about using the http functions, however https would be the prefered option.

Read the pdf doc about it.
https://iabtechlab.com/wp-content/uploads/2017/09/IABOpenRTB_Ads.txt_Public_Spec_V1-0-1.pdf

Read from 3.1 onward…

3.1 ACCESS METHOD

Publishers should post the “/ads.txt” file on their root domain and any subdomains as needed. For the purposes of this document the “root domain” is defined as the “public suffix” plus one string in the name. Crawlers should incorporate Public Suffix list [16] to derive the root domain.

The declarations must be accessible via HTTP and/or HTTPS from the website that the instructions are to be applied to under a standard relative path on the server host: “/ads.txt” and and HTTP request header containing “Content-Type: text/plain”. It may be advisable to additionally use “Content-Type: text/plain; charset=utf-8” to signal UTF8 support.

It is also advisable to prefer HTTPS connections over HTTP when crawling ads.txt files. In any case where data is available at an HTTPS and an HTTP connection for the same URL, the data from HTTPS should be preferred.

For convenience we will refer to this resource as the “/ads.txt” file, though the resource need in fact not originate from a file-system.

If the server response indicates Success (HTTP 2xx Status Code,) the advertising system must read the content, parse it, and utilize the declarations.

If the server response indicates an HTTP/HTTPS redirect (301, 302, 307 status codes), the advertising system should follow the redirect and consume the data as authoritative for the source of the redirect, if and only if the redirect is within scope of the original root domain as defined above. Multiple redirects are valid as long as each redirect location remains within the original root domain. For example an HTTP to HTTPS redirect within the same root domain is valid.

Only a single HTTP redirect to a destination outside the original root domain is allowed to facilitate one-hop delegation of authority to a third party’s web server domain. If the third party location returns a redirect, then the advertising system should treat the response as an error. A future version may address other delegation of authority to a third-party web server. Any other redirect should be interpreted as an error and ignored.

If the server response indicates the resource is restricted (HTTP 401) the advertising system should seek direct contact with the site for authorization keys or clarification.

If the server response indicates the resource does not exist (HTTP Status Code 404), the advertising system can assume no declarations exist and that no advertising system is unauthorized to buy and sell ads on the website. For any other HTTP error encountered for a Ads.txt Specification version 1.0.1 IAB Tech Lab IAB Tech Lab 6 URL which the crawler previously found data, the last successfully retrieved data set should be utilized.

3.2 FILE FORMAT

The data is encoded as a formatted plain text object, described here. The HTTP Content-type should be ‘text/plain’, and all other Content-types should be treated as an error and the content ignored. A complete description of the syntax of this format is given in section 3.4 below.

////// and the rest ///////

please make a detailed tutorial

Dear Friends,

Are there any easy solution for us who doesn’t know anything about html and only use Wix apps to create a website.

I’ve asked wix support, and they’ve shared with me
’ Click here to learn how to add a TXT record onto your domain. ’

But i guess, this is not what we are asking for. As i’ve checked wordpress has a plugin for that, but i couldn’t find in Wix.

I will be very happy if someone can explain easily to solve this problem :slight_smile:

Best Regards,
DD

Hi everyone
Jason can you describe in more detail. because ı tryed it but it isnt work. I think ı’m making a mistake

Hi everyone
Jason can you describe in more detail. because ı tryed it but it isnt work. I think ı’m making a mistake

is this code true?

import {ok, notFound, serverError} from ‘wix-http-functions’;
let adstxt = # Ads.txt
import wixData from ‘wix-data’;

export function get_Adstxt(request) {

let options = {

“headers”: {

“Content-Type”: “text/plain”

    }, 

“body”: adstxt

}; 

return ok(options)

}

@fsm4666 I dont know if you figured it out yet…In your editor you can click on Corvid and enable it first if you haven’t already yet. That allows you to get into the advanced side of your menu which allows to then access the backend

You are then able to place the template into the backend as jason has discribed.

Next you will want to add your google ad info into the template provided at the add text here make sure you have the little (') marks or it’ll come up as an error.

Then hit publish and move out to your dashboard and go to the settings and go to the seo tab
You will then goto the 301 redirect and you then can redirect your site from /ads.txt to /_functions/Adstxt

It took my a little while to figure out where to settings were. I hope this provided a little more info

@jason @jason11164 & @Andrew Seckora Thank you so much for providing this info! I’ve followed you steps and after typing in the url ( http://yourwebsite.com/_functions/Adstxt ) it seems to be working! I’m not familiar with coding but was wondering (just curious!) why the @ https://www.wix.com/corvid/forum/community-discussion/adding-ads-txt-file is necessary? what’s the function of it?

Does anyone happen to know if the pop up’s (regarding the missing ads.txt) in your Adsense account will automatically disappear once it worked? And if it’s a good indicator to know for sure it’s working?

@renorasims I’m glad it worked for you! I dont know what that discussion was getting at. There was a lot of info online that seemed to give a bunch of run arounds which made everything confusing

The Google adsense info says it takes about 24 hours for them to verify

 @Andrew Seckora 
 i have enabled corvid. I opened the at backends js file and
just type the following code and copy and paste in empty js file. saved and published. is it correct? my code is correct. then did the 301 redirection it was easy but the code didn't know it right. cod is that cay you check it please? =
 import {ok, notFound, serverError} from 'wix-http-functions'; 
 let adstxt =  `# Ads.txt `   import wixData from 'wix-data';  
 export function get_Adstxt(request) {   let options = {   "headers": {   "Content-Type": "text/plain"          },   "body": adstxt      };   return ok(options)  } 
Meanwhile .Thanks for your help

@aseckora I concur :smiley: It works!!! thank you so very much! Very important step when creating module as stated. (if anyone else is struggling.)

“Create a file called http-functions.js in your Backend folder of files.”

its not " http-functions.jsw" as it automatically creates it as its default… its “http-functions.js”
rename it!!

and I don’t know why it wasn’t obvious to me…(embarrassing as it might seem :roll_eyes:)

I finally succeeded. Thanks everyone