Skip to main content
Web Stories for WordPress provides multiple ways to monetize your content through automated ad placement and affiliate link integration.

Ad Networks

The plugin supports two primary ad networks for automated story ads:

Google AdSense

Google AdSense automatically places ads within your stories using <amp-story-auto-ads>.

Setup Instructions

  1. Navigate to Stories > Settings > Monetization
  2. Select Google AdSense as your ad network
  3. Enter your AdSense Publisher ID (format: ca-pub-XXXXXXXXXXXXXXXX)
  4. Enter your AdSense Ad Slot ID
  5. Save your settings
You must have an active AdSense account and be approved for AMP Stories ads before enabling this feature.

Configuration Example

The plugin generates the following markup (from includes/AdSense.php:92-103):
<amp-story-auto-ads>
  <script type="application/json">
  {
    "ad-attributes": {
      "type": "adsense",
      "data-ad-client": "ca-pub-XXXXXXXXXXXXXXXX",
      "data-ad-slot": "1234567890"
    }
  }
  </script>
</amp-story-auto-ads>
Google Ad Manager (formerly DoubleClick for Publishers) provides more control over ad inventory and targeting.

Setup Instructions

  1. Navigate to Stories > Settings > Monetization
  2. Select Google Ad Manager as your ad network
  3. Enter your Ad Manager Slot ID (format: /XXXXXX/slot-name)
  4. Save your settings

Configuration Example

The plugin generates the following markup (from includes/Ad_Manager.php:91-114):
<amp-story-auto-ads>
  <script type="application/json">
  {
    "ad-attributes": {
      "type": "doubleclick",
      "data-slot": "/12345678/story-ads"
    }
  }
  </script>
</amp-story-auto-ads>
Only one ad network can be active at a time. Enabling a new ad network will disable the previous one.

Custom Ad Configuration

You can customize the Ad Manager configuration using the WordPress filter:
add_filter('web_stories_ad_manager_configuration', function($config, $slot) {
    // Add custom targeting
    $config['ad-attributes']['json'] = json_encode([
        'targeting' => [
            'category' => 'technology',
            'topic' => 'web-development'
        ]
    ]);
    
    return $config;
}, 10, 2);
Available parameters:
  • $config - The ad configuration array
  • $slot - The Ad Manager slot ID
See includes/Ad_Manager.php:99-106 for implementation details. While the plugin doesn’t provide dedicated affiliate link functionality, you can easily add affiliate links to your stories:
Page attachments are perfect for affiliate content:
  1. Add a page attachment to your story page
  2. Include your affiliate link in the attachment content
  3. Add a call-to-action button that opens the attachment
  4. Track engagement through story_page_attachment_enter events

Ad Placement Best Practices

Frequency

Ads are automatically placed every 3-7 pages depending on story length. The algorithm ensures ads don’t disrupt the user experience.

Design

Story ads use the “Auto” format that matches your story’s design. The ad system automatically adapts colors and fonts to maintain visual consistency.

Performance

Monitor ad performance in your AdSense or Ad Manager dashboard. Stories typically see higher viewability rates compared to traditional display ads.

Requirements

AdSense Requirements

  • Active AdSense account
  • Site approved for AdSense
  • Site approved for AMP Stories ads (may require separate application)
  • Minimum content requirements met

Ad Manager Requirements

  • Active Google Ad Manager account
  • Configured ad units for AMP Stories
  • Line items targeting AMP Stories inventory
  • Creative assets optimized for 9:16 vertical format

Testing Ads

Before going live, test your ad implementation:
  1. Use AdSense/Ad Manager test mode to preview ads
  2. Check that ads appear at appropriate intervals
  3. Verify ads don’t break story navigation
  4. Test on multiple devices and screen sizes
  5. Validate AMP markup using the AMP Validator
In test mode, you may see placeholder ads or public service announcements. This is normal and won’t affect production ad delivery.

Disabling Ads

To disable ads on all stories:
  1. Navigate to Stories > Settings > Monetization
  2. Select None as your ad network
  3. Save your settings
To disable ads on specific stories, use this filter:
add_action('web_stories_print_analytics', function() {
    // Check if current story should have ads
    if (is_singular('web-story') && get_the_ID() === 123) {
        // Remove ad hooks for this story
        remove_action('web_stories_print_analytics', [get_instance_of('AdSense'), 'print_adsense_tag']);
        remove_action('web_stories_print_analytics', [get_instance_of('Ad_Manager'), 'print_ad_manager_tag']);
    }
}, 1);

Troubleshooting

  1. Verify your Publisher ID and Slot ID are correct
  2. Check that your account is approved for AMP Stories ads
  3. Ensure ad network is set to AdSense or Ad Manager (not “None”)
  4. Allow 24-48 hours for ad serving to begin
  5. Check browser console for AMP validation errors
Ad frequency is controlled by the <amp-story-auto-ads> algorithm and cannot be directly configured. However, shorter stories will naturally have fewer ads.
  1. Monitor viewability metrics in your ad dashboard
  2. Ensure stories meet Google’s quality guidelines
  3. Increase story publication frequency for better ad performance
  4. Check that ads are properly sized for mobile devices
  5. Consider using Ad Manager for better targeting and fill rates

Build docs developers (and LLMs) love