The Complete App-ads.txt Tutorial for Developers - 2025
Protect your mobile app's ad revenue from fraud.
Table of Contents
- What the Heck is App-ads.txt?
- Why Should You Care?
- How It Actually Works
- Setting Up App-ads.txt (Step by Step)
- Real-World Examples
- Common Gotchas and How to Fix Them
- Testing Your Setup
- Advanced Tips and Best Practices
- Troubleshooting Guide
What the Heck is App-ads.txt?
Imagine you're selling lemonade, and someone sets up a fake lemonade stand with your name on it, stealing your customers and money. That's essentially what happens in mobile advertising when bad actors impersonate your app to steal ad revenue.
App-ads.txt is like a public declaration that says "Hey world, these are the ONLY people authorized to sell ads in my app." It's a simple text file that you host on your website, and it helps prevent ad fraud by making it crystal clear who can legally sell your app's ad inventory.
Think of it as your app's "authorized dealers list" for advertising.
The Backstory
App-ads.txt was created by the IAB Tech Lab as an extension of the original ads.txt standard. While ads.txt protects websites, app-ads.txt specifically protects mobile and TV apps distributed through app stores. It launched because mobile ad fraud was costing developers billions of dollars annually.
Why Should You Care?
Here's the brutal truth: if you don't implement app-ads.txt, you're essentially leaving money on the table and inviting fraudsters to steal from you.
The Problems It Solves
1. Revenue Theft Bad actors create fake versions of your app in ad exchanges, steal your ad revenue, and you never see a penny.
2. Brand Damage Your app gets associated with low-quality or inappropriate ads because fraudsters are selling fake inventory under your name.
3. Wasted Advertiser Budgets Advertisers think they're buying ads in your legitimate app, but they're actually buying fraud. This makes them less likely to work with your app in the future.
4. Reduced Fill Rates Ad networks become suspicious of your app if they can't verify its authenticity, leading to lower ad fill rates and revenue.
The Benefits of Implementation
- Increased Ad Revenue: Advertisers pay more for verified, authentic inventory
- Better Fill Rates: Ad networks trust your app more
- Brand Protection: Your app's reputation stays intact
- Industry Compliance: Many ad networks now require app-ads.txt
How It Actually Works
Let's break down the process in simple terms:
The Players
- You (The App Developer): Create and maintain the app-ads.txt file
- Ad Networks: Companies like Google AdMob, Facebook, Unity Ads
- App Stores: Google Play, Apple App Store, etc.
- Advertisers/DSPs: Companies buying ad space
- Verification Systems: Crawlers that check app-ads.txt files
The Process
1. You publish your app with a developer website URL
2. You create an app-ads.txt file on that website
3. Ad networks include your app store URL in bid requests
4. Verification systems crawl your app store listing
5. They find your developer website from the store listing
6. They fetch your app-ads.txt file from your website
7. They verify if the ad network is authorized to sell your inventory
8. Unauthorized sellers get blocked, protecting your revenue
The Chain of Trust
App Store Listing → Developer Website → app-ads.txt file → Authorized Sellers
This creates an unbreakable chain that fraudsters can't easily fake.
Setting Up App-ads.txt (Step by Step)
Alright, let's get our hands dirty and actually implement this thing. Don't worry – it's easier than you think!
Step 1: Ensure You Have a Developer Website
This is absolutely critical. Your app store listings MUST include a developer website URL. Here's how to check and add it:
For Google Play Store:
- Go to Google Play Console
- Navigate to "App information" → "Store listing"
- Look for the "Website" field
- If empty, add your website URL (e.g.,
https://yourcompany.com
) - Save and publish
For Apple App Store:
- Go to App Store Connect
- Navigate to your app → "App Information"
- Look for "Marketing URL" field
- Add your website URL
- Submit for review (this requires an app update)
Pro Tip: The website doesn't need to be fancy. A simple landing page works fine, but it must be the same domain where you'll host your app-ads.txt file.
Step 2: Get Your Publisher IDs
Before creating the file, you need to collect your publisher IDs from each ad network you work with.
Google AdMob:
- Sign in to AdMob console
- Go to "Apps" → Select your app
- Click the "app-ads.txt" tab
- Copy the provided snippet (it includes your publisher ID)
Facebook Audience Network:
- Go to Facebook Monetization Manager
- Navigate to "Monetization Tools" → "App ads.txt"
- Copy your publisher ID
Unity Ads:
- Go to Unity Dashboard
- Navigate to "Monetize" → "Projects"
- Find your Game ID (this is your publisher ID)
Other Networks:
Check each network's documentation or contact their support for the correct domain and publisher ID format.
Step 3: Create Your app-ads.txt File
Create a plain text file named app-ads.txt
(note: NOT ads.txt
). Here's the format:
[ad_network_domain], [your_publisher_id], [relationship], [certification_authority_id]
Real Example:
```
App-ads.txt for MyAwesomeApp
Updated: 2025-06-17
google.com, ca-app-pub-1234567890123456~1234567890, DIRECT, f08c47fec0942fa0 facebook.com, 123456789, DIRECT, c3e20eee3f780d68 unity.com, 1234567, DIRECT, 96cabb5fbdde37a7 applovin.com, abc123def456, DIRECT, 6a698e2ec38604c6
Reseller example (if you use a mediation platform)
ironsrc.com, 987654321, RESELLER, 83e75a7ae333ca9d ```
Field Breakdown:
Field 1 - Ad Network Domain: The official domain of the ad network
- Google AdMob: google.com
- Facebook: facebook.com
- Unity: unity.com
- AppLovin: applovin.com
Field 2 - Publisher ID: Your unique identifier with that network
- Must match exactly what appears in ad requests
- For AdMob: Usually starts with ca-app-pub-
- For Facebook: Numeric ID
- For Unity: Your Game ID
Field 3 - Relationship Type:
- DIRECT
: You have a direct contract with this ad network
- RESELLER
: Someone else (like a mediation platform) manages this relationship
Field 4 - Certification Authority ID: - Optional but recommended - Unique identifier for the ad network - Get this from the ad network's documentation
Step 4: Upload the File to Your Website
The file MUST be accessible at https://yourdomain.com/app-ads.txt
(at the root level).
For Static Sites (GitHub Pages, Netlify, etc.):
your-website/
├── index.html
├── app-ads.txt ← Put it here
└── other-files/
For WordPress:
- Upload via FTP to your site's root directory
- Or use a plugin like "Ads.txt Manager"
- Make sure it's accessible at
yoursite.com/app-ads.txt
For Custom Servers:
Configure your server to serve the file at the /app-ads.txt
path.
Using Redirects (Advanced):
If you can't put the file directly at the root, you can use redirects:
```apache
.htaccess example
RewriteRule ^app-ads.txt$ /static/app-ads.txt [R=301,L] ```
```nginx
nginx example
location = /app-ads.txt { return 301 /static/app-ads.txt; } ```
Step 5: Update Your App Store Listings
Make sure your developer website URL is correctly set in ALL app stores where your app is published. This is crucial because verification systems will look for this URL.
Real-World Examples
Let's look at some practical examples of app-ads.txt files for different scenarios.
Example 1: Simple Setup (One Ad Network)
```
app-ads.txt for Simple Game
google.com, ca-app-pub-1234567890123456~1234567890, DIRECT, f08c47fec0942fa0 ```
Example 2: Multiple Ad Networks
```
app-ads.txt for Multi-Network App
Primary monetization
google.com, ca-app-pub-1234567890123456~1234567890, DIRECT, f08c47fec0942fa0 facebook.com, 987654321, DIRECT, c3e20eee3f780d68
Backup networks
unity.com, 1234567, DIRECT, 96cabb5fbdde37a7 applovin.com, abc123def456, DIRECT, 6a698e2ec38604c6 ironsrc.com, 12345678, DIRECT, 83e75a7ae333ca9d ```
Example 3: Using Mediation Platform
```
app-ads.txt for Mediated App
Direct relationships
google.com, ca-app-pub-1234567890123456~1234567890, DIRECT, f08c47fec0942fa0
Through mediation platform (marked as RESELLER)
facebook.com, 987654321, RESELLER, c3e20eee3f780d68 unity.com, 1234567, RESELLER, 96cabb5fbdde37a7 applovin.com, abc123def456, RESELLER, 6a698e2ec38604c6
The mediation platform itself
ironsrc.com, 12345678, DIRECT, 83e75a7ae333ca9d ```
Example 4: Enterprise Setup with Contact Info
```
app-ads.txt for Enterprise App Suite
Contact: [email protected]
Last updated: 2025-06-17
Primary ad networks
google.com, ca-app-pub-1234567890123456~1234567890, DIRECT, f08c47fec0942fa0 facebook.com, 987654321, DIRECT, c3e20eee3f780d68
Video ad networks
unity.com, 1234567, DIRECT, 96cabb5fbdde37a7 applovin.com, abc123def456, DIRECT, 6a698e2ec38604c6
Regional networks
adcolony.com, def789ghi012, DIRECT, 1ad675c9de6b5176 tapjoy.com, jkl345mno678, DIRECT, 29e595b1aeb5904b
[email protected] contact=https://mycompany.com/advertising-contact ```
Common Gotchas and How to Fix Them
Here are the mistakes I see developers make all the time (and how to avoid them):
Gotcha #1: Wrong File Name
Problem: Naming the file ads.txt
instead of app-ads.txt
Fix: Mobile apps require app-ads.txt
, not ads.txt
. They're different standards!
Gotcha #2: Wrong Publisher ID Format
Problem: Using the wrong format for publisher IDs
Fix: Copy the exact format from your ad network's dashboard. For AdMob, include the full ID with tilde (~
).
Gotcha #3: Missing Developer Website in App Store
Problem: Not setting the developer website URL in app store listings Fix: Add your website URL to ALL app stores where your app is published.
Gotcha #4: File Not at Root Level
Problem: Putting the file at yoursite.com/files/app-ads.txt
instead of yoursite.com/app-ads.txt
Fix: The file must be accessible at the root level. Use redirects if necessary.
Gotcha #5: Wrong Relationship Type
Problem: Marking everything as DIRECT
when some should be RESELLER
Fix: Use DIRECT
only for networks you have direct contracts with. Use RESELLER
for networks you access through mediation platforms.
Gotcha #6: Forgetting to Update After Changes
Problem: Adding new ad networks but forgetting to update app-ads.txt Fix: Set a calendar reminder to review and update your file monthly.
Gotcha #7: Different Website URLs Across App Stores
Problem: Using different website URLs in Google Play vs App Store Fix: Use the same domain across all app stores to avoid confusion.
Testing Your Setup
Before going live, let's make sure everything works correctly.
Quick Tests You Can Do Right Now
1. Browser Test
Open your browser and navigate to:
https://yourdomain.com/app-ads.txt
You should see your file content, not a 404 error.
2. cURL Test (For Developers)
bash
curl -I https://yourdomain.com/app-ads.txt
Should return HTTP/1.1 200 OK
and Content-Type: text/plain
.
3. Different Device Test
Test from your phone's browser to make sure it works on mobile networks too.
Validation Tools
Google AdMob Validator
- Go to AdMob console
- Navigate to "Apps" → Your app
- Click "app-ads.txt" tab
- Click "Check for updates"
- Look for green checkmarks
IAB App-ads.txt Validator (Third-party)
Several online tools can validate your file format: - Check for syntax errors - Verify field formats - Confirm accessibility
What to Look For
✅ File loads without errors
✅ Correct MIME type (text/plain
)
✅ All your ad networks listed
✅ Publisher IDs match your dashboards
✅ No syntax errors (commas in right places)
Advanced Tips and Best Practices
Now that you've got the basics down, let's level up your app-ads.txt game.
Organization Tips
Use Comments Wisely
```
=================================
PRIMARY AD NETWORKS
=================================
google.com, ca-app-pub-1234567890123456~1234567890, DIRECT, f08c47fec0942fa0 facebook.com, 987654321, DIRECT, c3e20eee3f780d68
=================================
VIDEO AD NETWORKS
=================================
unity.com, 1234567, DIRECT, 96cabb5fbdde37a7 applovin.com, abc123def456, DIRECT, 6a698e2ec38604c6
=================================
MEDIATION PLATFORMS
=================================
ironsrc.com, 12345678, DIRECT, 83e75a7ae333ca9d
Last updated: 2025-06-17
Contact: [email protected]
```
Version Control
Treat your app-ads.txt file like code: - Keep it in your repository - Use meaningful commit messages - Track changes over time - Have a rollback plan
Automation Strategies
Automated Updates
Create a script that automatically updates your app-ads.txt when you add new ad networks:
```javascript // Example: Generate app-ads.txt from configuration const adNetworks = [ { domain: 'google.com', pubId: 'ca-app-pub-123~456', relation: 'DIRECT', cert: 'f08c47fec0942fa0' }, { domain: 'facebook.com', pubId: '987654321', relation: 'DIRECT', cert: 'c3e20eee3f780d68' } ];
const generateAppAdsTxt = () => {
let content = '# Auto-generated app-ads.txt\n';
content += # Generated: ${new Date().toISOString()}\n\n
;
adNetworks.forEach(network => {
content += ${network.domain}, ${network.pubId}, ${network.relation}, ${network.cert}\n
;
});
return content; }; ```
CI/CD Integration
Add app-ads.txt validation to your deployment pipeline:
```yaml
GitHub Actions example
- name: Validate app-ads.txt run: | curl -f https://yoursite.com/app-ads.txt # Add custom validation logic here ```
Security Considerations
HTTPS Only
Always serve your app-ads.txt over HTTPS to prevent tampering.
Regular Monitoring
Set up alerts to notify you if: - Your app-ads.txt file becomes inaccessible - Unauthorized changes are made - New ad networks appear without your approval
Access Control
Limit who can modify your app-ads.txt file: - Use proper file permissions - Implement approval workflows - Log all changes
Multi-App Management
Single Domain Strategy
Host one app-ads.txt file for all your apps: ```
app-ads.txt for MyCompany (all apps)
google.com, ca-app-pub-1234567890123456~1234567890, DIRECT, f08c47fec0942fa0 google.com, ca-app-pub-1234567890123456~0987654321, DIRECT, f08c47fec0942fa0 ```
Subdomain Strategy
Use different subdomains for different app categories:
games.mycompany.com/app-ads.txt ← For game apps
utils.mycompany.com/app-ads.txt ← For utility apps
Performance Optimization
CDN Usage
Serve your app-ads.txt through a CDN for faster global access: - Cloudflare - AWS CloudFront - Azure CDN
Caching Headers
Set appropriate cache headers:
Cache-Control: public, max-age=86400
File Size Optimization
Keep your file lean: - Remove unnecessary comments - Use consistent formatting - Avoid duplicate entries
Troubleshooting Guide
When things go wrong (and they sometimes do), here's your emergency toolkit.
Problem: "app-ads.txt not found" Error
Symptoms: Ad networks report they can't find your file
Diagnosis Steps:
1. Test file accessibility: curl https://yourdomain.com/app-ads.txt
2. Check app store listings for correct website URL
3. Verify DNS resolution: nslookup yourdomain.com
4. Test from different locations/networks
Common Causes & Fixes: - File at wrong path: Move to root directory - Server configuration issue: Check redirects and rewrites - DNS problems: Contact your hosting provider - SSL certificate issues: Ensure HTTPS works properly
Problem: Ad Networks Still Report "Unauthorized"
Symptoms: File exists but networks don't recognize authorization
Diagnosis Steps: 1. Validate file format and syntax 2. Compare publisher IDs with network dashboards 3. Check for invisible characters or encoding issues 4. Verify relationship types (DIRECT vs RESELLER)
Common Causes & Fixes: - Wrong publisher ID: Copy exact ID from network dashboard - Incorrect domain: Use canonical domain from network docs - Wrong relationship type: Use DIRECT for direct partnerships - File encoding: Save as plain text UTF-8
Problem: Some Networks Work, Others Don't
Symptoms: Partial success with authorization
Diagnosis Steps: 1. Compare working vs non-working entries 2. Check each network's specific requirements 3. Verify certification authority IDs 4. Test file parsing with different tools
Common Causes & Fixes: - Network-specific formats: Check each network's documentation - Missing cert IDs: Add certification authority IDs - Whitespace issues: Remove extra spaces or tabs - Case sensitivity: Use exact case as specified
Problem: File Loads in Browser but Networks Can't Access
Symptoms: Manual access works, automated crawlers fail
Diagnosis Steps: 1. Check server logs for crawler requests 2. Test with different user agents 3. Verify robots.txt doesn't block crawlers 4. Check rate limiting or firewall rules
Common Causes & Fixes: - Bot blocking: Whitelist ad network crawlers - Rate limiting: Increase limits for verification bots - Geographic restrictions: Allow global access - robots.txt blocking: Ensure /app-ads.txt is allowed
Problem: Changes Not Taking Effect
Symptoms: Updated file but networks still see old version
Diagnosis Steps: 1. Clear CDN cache if using one 2. Check file modification timestamp 3. Verify you updated the correct file location 4. Test from different geographic locations
Common Causes & Fixes: - CDN caching: Force cache invalidation - Browser caching: Hard refresh or test from new device - Network propagation: Wait 24-48 hours for full propagation - Wrong file updated: Verify you're editing the live file
Emergency Checklist
When everything seems broken, go through this checklist:
- [ ] File accessible at
https://yourdomain.com/app-ads.txt
- [ ] Returns HTTP 200 status code
- [ ] Content-Type is
text/plain
- [ ] File contains valid entries (no syntax errors)
- [ ] Publisher IDs match network dashboards exactly
- [ ] Developer website URL set in all app stores
- [ ] Same domain used in app stores and hosting file
- [ ] No robots.txt blocking /app-ads.txt
- [ ] HTTPS certificate valid and working
- [ ] File encoding is UTF-8 (no BOM)
Getting Help
If you're still stuck:
- Network Support: Contact your ad network's support team with:
- Your app store URLs
- Your website URL
-
Screenshots of error messages
-
Developer Communities:
- Stack Overflow (tag: app-ads.txt)
- Reddit: r/androiddev, r/iOSProgramming
-
Discord communities for mobile developers
-
Professional Services: Consider hiring an ad ops consultant for complex setups
Keeping Your App-ads.txt Healthy
App-ads.txt isn't a "set it and forget it" thing. Here's how to maintain it properly.
Regular Maintenance Schedule
Monthly Review (5 minutes)
- Check file accessibility
- Verify no broken ad network relationships
- Review ad network performance
- Update comments with current date
Quarterly Audit (30 minutes)
- Compare file entries with active ad networks
- Remove networks you're no longer using
- Add new networks you've integrated
- Check for new certification authority IDs
- Review and optimize file organization
Annual Deep Dive (2 hours)
- Complete security audit
- Performance analysis
- Review automation processes
- Update documentation
- Train team members on changes
Monitoring Setup
Automated Monitoring
Set up monitoring to alert you when: ```bash
Example monitoring script
!/bin/bash
RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" https://yourdomain.com/app-ads.txt) if [ $RESPONSE -ne 200 ]; then echo "Alert: app-ads.txt returned HTTP $RESPONSE" # Send notification (email, Slack, etc.) fi ```
Key Metrics to Track
- File accessibility uptime
- Response time from different locations
- Ad network recognition status
- Revenue impact from verified inventory
Documentation
Keep a record of: - Change log: What changed and when - Network contacts: Who to contact at each ad network - Integration dates: When each network was added - Performance notes: Which networks perform best
Team Training
Make sure your team knows: - How to update the file safely - What each field means - When to use DIRECT vs RESELLER - How to test changes - Who to contact for help
Conclusion
Congratulations! You now know more about app-ads.txt than 90% of mobile developers out there.
Here's your action plan:
Immediate Actions (Do This Week)
- Create your app-ads.txt file with current ad networks
- Upload it to your website root
- Verify it's accessible and working
- Check all your app store listings have the correct website URL
Short-term Goals (Next Month)
- Monitor ad network recognition status
- Set up automated monitoring
- Document your process for team members
- Measure revenue impact
Long-term Strategy (Ongoing)
- Regular monthly reviews
- Stay updated with industry changes
- Optimize based on performance data
- Help other developers implement it correctly
Final Thoughts
App-ads.txt might seem like a small technical detail, but it's actually a crucial part of protecting your app's revenue and reputation. The mobile advertising ecosystem depends on trust, and app-ads.txt is one of the key tools that builds that trust.
Yes, it requires some initial setup and ongoing maintenance, but the protection it provides against ad fraud and the increased revenue from verified inventory make it absolutely worth the effort.
Now stop reading and go implement it! Your future self (and your bank account) will thank you.
Additional Resources
Official Documentation
Tools and Validators
Community Resources
Last updated: June 17th 2025 | Found an error or have suggestions? Please contribute!