How to add amp adsense code to xenforo 2 simple

admin

Administrator
Staff member
Today, tuoitreit.vn will teach you how to add amp adsense code to xenforo



1. Please go to Appearance > Styles > Default Style - Templates and edit template seo_amp_PAGE_CONTAINER
Find
JavaScript:
<script async src="https://cdn.ampproject.org/v0.js"></script>
And replace with
JavaScript:
<script async custom-element="amp-auto-ads"
        src="https://cdn.ampproject.org/v0/amp-auto-ads-0.1.js">
Find
HTML:
<xf:if is="$description is not empty">
And replace wth
HTML:
<amp-ad width="100vw" height=320
  type="adsense"
  data-ad-client="ca-pub-abcd"
  data-ad-slot="abcde"
  data-auto-format="rspv"
  data-full-width>
    <div overflow></div>
</amp-ad>
                        <xf:if is="$description is not empty">
Replace abcd and abcde with your data-ad-client and data-ad-slot
2. Go to Appearance > Styles > Default Style - Templates and edit template seo_amp_thread_view
Find
HTML:
<div class="blockMessage" style="margin-top: 20px">
And replace with
HTML:
<amp-ad width="100vw" height=320
  type="adsense"
  data-ad-client="ca-pub-abcd"
  data-ad-slot="abcde"
  data-auto-format="rspv"
  data-full-width>
    <div overflow></div>
</amp-ad>
<div class="blockMessage" style="margin-top: 20px">
Replace abcd and abcde with your data-ad-client and data-ad-slot

Good luck
Source tuoitreit.vn
 

Facebook Comments


New posts New threads New resources

Top