With Wix Ads.txt, site owners can define which Authorized Digital Sellers are allowed to sell digital advertisements on their site. This enables them to increase revenue, while ensuring security, privacy, and transparency.
The Ads.txt APIs allow your app to:
The Ads.txt project is a simple, flexible, and secure method for publishers and distributors to declare authorized sellers. Read more about Ads.txt and its functionality on the website of the Interactive Advertising Bureau (IAB).
This article shares a possible use case for your app. You're certainly not limited to this use case, but it might be a helpful start to plan your app's implementation.
The owners of a fitness blog would like to increase revenue by displaying advertisements on their Wix site. Your app will modify the existing Ads.txt file to enable a content discovery platform as an authorized seller.
To add an authorized digital seller, your app will call the Append Ads.txt endpoint. You’ll need to pass the platform’s name, account id, payment type, and tag id inside the content
field of the adsTxt
object. You can read more about the structure of Ads.txt files on the IAB’s website.
curl -X PATCH https://www.wixapis.com/promote-seo-txt-file-server/v2/ads \
--header 'Content-Type: application/json;charset=UTF-8' \
--header 'Authorization: <AUTH>' \
--data-binary '{"adsTxt": {"content": "silveradexchange.com, pub-0000000000000001, RESELLER, b124y6716v287058"}}'
Notice that the content field in the response has two lines, separated by the new line (\n) control character.
{
"adsTxt": {
"content": "google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0\nsilveradexchange.com, pub-0000000000000001, RESELLER, b124y6716v287058",
"default": false,
"subdomain": "www"
}
}
Content of Ads.txt.
Whether current Ads.txt is Wix's default.
Subdomain of Ads.txt, for example www
, es
, fr
. Default is www
.
Updates the Ads.txt file.
When setting the content
object to an empty string, an empty Ads.txt file will be created.
In order to reset Ads.txt to Wix's default, send default: true
without a content
object.
You can only call this method when authenticated as a Wix app or Wix user identity.
Submitted adsTxT
object will replace the existing Ads.txt file.
To reset Ads.txt to Wix's default, submit default:true
without a content
object.
Updated Ads txt object
curl PUT https://www.wixapis.com/promote-seo-txt-file-server/v2/ads \
-H 'Content-Type: application/json;charset=UTF-8' \
-H 'Authorization: <AUTH>' \
-d '{"adsTxt": {"content": "google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0", "subdomain": "www"}}'
{
"adsTxt": {
"content": "google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0",
"default": false,
"subdomain": "www"
}
}
There is 1 error with this status code:
See the entire list and learn more about Wix errors.
Retrieves the Ads.txt file.
You can only call this method when authenticated as a Wix app or Wix user identity.
Subdomain of Ads.txt, for example www
, es
, fr
. Default is www
.
Ads txt object
curl GET https://www.wix.com/_api/promote-seo-txt-file-server/v2/ads \
-H 'Content-Type: application/json;charset=UTF-8' \
-H 'Authorization: <AUTH>' \
-H 'subdomain: www'
{
"adsTxt": {
"content": "google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0",
"default": false,
"subdomain": "www"
}
}
There is 1 error with this status code:
See the entire list and learn more about Wix errors.
Appends the submitted content
object to Ads.txt.
In order to reset Ads.txt to Wix's default, send default: true
without a content
object.
You can only call this method when authenticated as a Wix app or Wix user identity.
Submitted content
object will be appended to the existing Ads.txt file.
To reset Ads.txt to Wix's default, submit default:true
without a content
object.
Appended Ads.txt file.
curl PATCH https://www.wixapis.com/promote-seo-txt-file-server/v2/ads \
-H 'Content-Type: application/json;charset=UTF-8' \
-H 'Authorization: <AUTH>' \
-d '{"adsTxt": {"content": "google.com, pub-0000000000000001, DIRECT, f08c47fec0942fa0", "subdomain": "www"}}'
{
"adsTxt": {
"content": "google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0\ngoogle.com, pub-0000000000000001, DIRECT, f08c47fec0942fa0",
"default": false,
"subdomain": "www"
}
}
There is 1 error with this status code:
See the entire list and learn more about Wix errors.
Unique event ID. Allows clients to ignore duplicate webhooks.
Fully qualified domain name of the entity associated with the event. Expected wix.promote.marketing.ads_txt
.
Event name. Expected updated
.
ID of the entity associated with the event.
Event timestamp.
Whether the event was triggered as a result of a privacy regulation application (for example, GDPR).
If present, indicates the action that triggered the event.
Event information.
The data payload will include the following as an encoded JWT:
{
"data": {
"eventType": "wix.promote.marketing.ads_txt_updated",
"instanceId": "<app-instance-id>",
"data": "<stringified-JSON>",
// The identity field is sent as a stringified JSON
"identity": {
"identityType": "<identityType>", // ANONYMOUS_VISITOR, MEMBER, WIX_USER, APP
"anonymousVisitorId": "<anonymousVisitorId>", // in case of ANONYMOUS_VISITOR
"memberId": "<memberId>", // in case of MEMBER
"wixUserId": "<wixUserId>", // in case of WIX_USER
"appId": "<appId>" // in case of APP
}
}
}
{
"content": "test",
"default": false,
"subdomain": "www"
}