This page short URL: xk

weeblrAMP has an extensive support for inserting Ads in your Accelerated Mobile Pages. By default, the Ads network settings are global, ie the same network will be used throughout all AMP pages. But you can also manually insert ads from any ad networks the AMP project supports by means of tags in your content.

Built-in support

weeblrAMP Ads networks list

The AMP specification allows a very large number of Ads networks, and the list is continuously growing. weeblrAMP provides support for the following, and then you should use the Custom type for all others:

  • A9
  • AdReactor
  • AdSense
  • AdTech
  • Double-click

Each of those networks has a separate section in the settings, where you can input appropriate parameters for the given network. The list of accepted ad networks is maintained by the AMP project on this page. Be sure to only try to display ads from one of the networks listed there, anything else will not work.

Ads location and type

With built-in support, ads can be displayed automatically:

  • before or after the main page content
  • at regular interval in between paragraphs
  • at specific paragraph positions

weeblrAMP ads location

Ads location

  • Show before content and Show after content: select these options to insert ads from the currently selected ads network in 2 predefined locations, respectively before and after a page main content. When either one is selected, and you use shortcode or automatic ads insertion (see below), ads will be displayed from all those sources: before or after content, and also from the shortcodes/auto-insert

  • Show ads from shortcodes/autoinsert only: with this option, you can use shortcodes, or automatically insert ads inside your content, but ads won't be inserted before or after the page main block.

Automatic insertion of ads based on paragraph count is only supported in the regular edition of weeblrAMP.

Auto-insert ads in posts / Auto-insert ads in pages

With these 2 settings, you can instructs weeblrAMP to insert ads from your selected ads network inside your posts (or pages, respectively) text. The insertion is based on the number of paragraphs in the text.

As shown on the screenshot above, there are 2 ways to specify where you want ads inserted:

Insert ads every N paragraphs

To insert ad on a regular basis in your article, use the syntax: /N where N is how many paragraphs you want between ads.

Example: /3 will insert an ad every 3 paragraphs (starting at the 3rd paragraph)

Insert ads at specific positions

You can also specify exactly where you want those ads inserted as in this example:

1,3,6

will insert an ad after the 1st paragraph, then the 3rd and then the 6th.

Notes on ads auto-insert

  • weeblrAMP will count paragraphs in your posts and pages in the following way:

    • empty paragraphs, or paragraphs containing only spaces are not counted
    • paragraphs with less than 20 characters are not counted
  • Ads auto-insertion can be modified with filters

There are several filters you can use to alter the default behavior. Some interesting things you can do with those filters are:

  • Disable automatic ads insertion on some post based on their category or tags
  • Change how many characters is required for a paragraph to be counted
  • Dynamically change the auto-insert rules (every 2, every 5, etc) based on the current page post, page, category, taxonomy, etc

Please refer to the hooks reference documentation for more details, under the section Ads.

Ads display details

For built-in support as well, you have a few settings to fill-in:

weeblrAMP ads location

  • Ads location: whether ads will be located before or after the main page content
  • Ad width and Ad height: as those cannot be determined automatically, you will have to enter them, in pixels
  • Placeholder: this is an optional text you can set. It will be displayed by AMP until the Ads actually shows up (which will take longer than the rest of the page)
  • Fallback: this is also an optional text, which is displayed if the Ads fails to show - for instance in case of network failure, or invalid parameters

Other networks

Though we strive to include as many ads networks to weeblrAMP as possible, you can already support any network by using the Custom network option when selecting your desired ads network. After selecting the Custom ads network as your ads network type, enter in the specific input box the raw amp-ad content needed for your ad:

Entering custom ads network markup

The sample above is just that, a sample. You will need to talk to your ads network company to find out which exact syntax to use. weeblrAMP will not perform any real check on this, so be sure to verify your syntax is correct, and then test your page.

Displaying ads in other locations

weeblrAMP lets you insert ads automatically before or after your main content, using the Ads location parameter. However, you can also insert ads in almost any other location of your content using a specific shortcode:

[wbamp-embed type="ad"]

This tag has multiple forms, and lets you insert ads from any network, not just the one you selected in the weeblrAMP settings. Please read about all possible options on next page.

Automatic insertion of ads based on shortcodes is only supported in the regular edition of weeblrAMP.