How to show an ad every X posts?

Answer

If you want to show an ad every few posts, it is possible by wrapping the adcode inside a <xf:if ...>-tag

We recommend that you create an Advertiesement with position set to one of the following:

  • Post: Below message container [AMP] (nicer looking)
  • Post: Below message content [AMP]

In the HTML field set the following:

<xf:if is="$post.position % 3 == 1">
    <amp-ad width="100vw" height="320"
         type="adsense"
         data-ad-client="ca-pub-..."
         data-ad-slot="..."
         data-auto-format="rspv"
         data-full-width="">
      <div overflow=""></div>
    </amp-ad>
</xf:if>

The important part here is the % 3 == 1 which will dictate that it inserts every 3 posts, starting from the 2nd post (3-1=2)