Cookbook
Mr. Pickles the AdPlugg Pug

Adding an Ads.txt File to Your Wix Site

This recipe teaches you how to add an ads.txt file to your Wix site (for example at https://www.example.com/ads.txt).

  • Log into your Wix admin.
  • Go to Site Actions and then choose Edit Site.
  • At the top, choose Dev Mode and then click the Turn on Dev Mode button.
  • In the left sidebar, expand Backend and click Add a New Web Module.
  • Click the gear, and choose Rename. Rename the Web Module "http-functions.js" (without the quotes). Note: this name is important, it must be exactly as shown.
  • Delete any starter code and then paste in the below code. Note: if you already had an http-functions.js file, leave the existing contents and just add this code to the bottom.

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

let adstxt = `<ADS.TXT CONTENT FROM ADPLUGG SUPPORT GOES HERE>`;

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

    return ok(options);
}


  • Replace <ADS.TXT CONTENT FROM ADPLUGG SUPPORT GOES HERE> in the code with the ads.txt content that you received from AdPlugg Support.
  • Back in the Wix admin, press the Publish button.
  • You should now be able to view your new page at https://www.yourdomain.com/_functions/Adstxt
  • Now we will set up a redirect to serve this same page from /ads.txt.
  • Exit Dev Mode (Dev Mode > Turn off Dev Mode).
  • Exit the editor and go back to your Wix Dashboard.
  • In the left sidebar, choose Marketing and SEO and then choose SEO Tools.
  • Scroll down and choose "URL Redirect Manager".
  • In the top right, click the New Redirect button.
  • In the Old URL field, enter "/ads.txt" (without the quotes).
  • In the New URL field, enter "_functions/Adstxt" (without the quotes).
  • Press the Save & Close button.
  • You should now be able to access your ads.txt file at https://www.yourdomain.com/ads.txt