Title: Adsense ad code bug
Last modified: May 21, 2020

---

# Adsense ad code bug

 *  [onlanka](https://wordpress.org/support/users/onlanka/)
 * (@onlanka)
 * [6 years ago](https://wordpress.org/support/topic/adsense-ad-code-bug/)
 * Today I noticed there is serious issue in Adsense ad code which generated using
   account ID and ad slot ID.
 * See this code has no spaces between `data-ad-slot="1697923694"data-auto-format
   ="rspv"`
 *     ```
       <amp-ad class="amp-ad-1"
       					type="adsense"
       					width=100vw height=320
       					data-ad-client="ca-pub-3918084299684199"
       					data-ad-slot="1697923694"data-auto-format="rspv"
       					   data-full-width>
       ```
   
 * If you do view source in Firefox browser you’ll see adsense code in red color
   due to no spaces (code line number 899, code line number 924, code line number
   1121).
 * Please fix this issue
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fadsense-ad-code-bug%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Thread Starter [onlanka](https://wordpress.org/support/users/onlanka/)
 * (@onlanka)
 * [6 years ago](https://wordpress.org/support/topic/adsense-ad-code-bug/#post-12868244)
 * Also I see some differences between your plugin’s adsense ad code and original
   adsense code.
 * **Your code:**
 *     ```
       <amp-ad class="amp-ad-1"
       					type="adsense"
       					width=100vw height=320
       					data-ad-client="ca-pub-3918084299684199"
       					data-ad-slot="4519140623"data-auto-format="rspv"
       					   data-full-width><div overflow></div></amp-ad>
       ```
   
 * **Original code:**
 *     ```
       <amp-ad width="100vw" height="320"
            type="adsense"
            data-ad-client="ca-pub-3918084299684199"
            data-ad-slot="4519140623"
            data-auto-format="rspv"
            data-full-width="">
         <div overflow=""></div>
       </amp-ad>
       ```
   
 * **Followings are incorrect parts I noticed in your ad code:**
 * 1. `data-ad-slot="4519140623"data-auto-format="rspv"` (No spaces)
    2. `data-full-
   width>` ( data-full-width`=""` is missing ) 3. `<div overflow>` ( data-full-width`
   =""` is missing )
 * 4. This might be not and issue, but also check this as well:
 *     ```
       <script custom-element="amp-position-observer" src="https://cdn.ampproject.org/v0/amp-position-observer-0.1.js" async></script>
       			<script custom-element="amp-animation" src="https://cdn.ampproject.org/v0/amp-animation-0.1.js" async></script>
       			<script custom-element="amp-ad" src="https://cdn.ampproject.org/v0/amp-ad-0.1.js" async></script>
       ```
   
 * **`async`** should be added at very first, `<script async`
 * **Original Adsense AMP ad code implementation has:**
 * `<script async custom-element="amp-ad" src="https://cdn.ampproject.org/v0/amp-
   ad-0.1.js"></script>`
    -  This reply was modified 6 years ago by [onlanka](https://wordpress.org/support/users/onlanka/).
      Reason: some code edits
    -  This reply was modified 6 years ago by [onlanka](https://wordpress.org/support/users/onlanka/).
    -  This reply was modified 6 years ago by [onlanka](https://wordpress.org/support/users/onlanka/).
 *  Plugin Author [Ahmed Kaludi](https://wordpress.org/support/users/ahmedkaludi/)
 * (@ahmedkaludi)
 * [6 years ago](https://wordpress.org/support/topic/adsense-ad-code-bug/#post-12876309)
 * Thank you for your valuable information. Can you please share the list of active
   plugins on your AMP page?
 *  Thread Starter [onlanka](https://wordpress.org/support/users/onlanka/)
 * (@onlanka)
 * [6 years ago](https://wordpress.org/support/topic/adsense-ad-code-bug/#post-12876386)
 * [@ahmedkaludi](https://wordpress.org/support/users/ahmedkaludi/) I removed adsense
   ad codes 5 minutes ago.
 * I will only use adsense amp auto ads from now.
 * It’ll need only the code between <head></head> and another code between <body
   ></body>
 * Those are appearing correctly.
 * So you can check adsense ad code issues by placing ad codes from your end.
 *  Plugin Author [Ahmed Kaludi](https://wordpress.org/support/users/ahmedkaludi/)
 * (@ahmedkaludi)
 * [6 years ago](https://wordpress.org/support/topic/adsense-ad-code-bug/#post-12877633)
 * yes, we tried and many other customers tried and it is working fine, there seems
   to be a specific issue, I want to help you but I need to see the issue, only 
   then we can do something about it
 *  Thread Starter [onlanka](https://wordpress.org/support/users/onlanka/)
 * (@onlanka)
 * [6 years ago](https://wordpress.org/support/topic/adsense-ad-code-bug/#post-12878736)
 * [@ahmedkaludi](https://wordpress.org/support/users/ahmedkaludi/) ok, I’m using
   following wordpress plugins for my site:
    1.  **Accelerated Mobile Pages** – (By Ahmed Kaludi, Mohammed Kaludi)
    2.  **Akismet Anti-Spam** – (By Automattic)
    3.  **All 404 Redirect to Homepage** – (By Fakhri Alsadi)
    4.  **Better Recent Comments** – (By Barn2 Media)
    5.  **Better Search Replace** – (By Delicious Brains)
    6.  **Classic Editor** – (By WordPress Contributors)
    7.  **Cookie Notice** – (By dFactory)
    8.  **Default featured image** – (By Jan Willem Oostendorp)
    9.  **Form Maker** – (By 10Web Form Builder Team)
    10. **Limit Login Attempts Reloaded** – (By WPChef)
    11. **MaxButtons** – (By Max Foundry)
    12. **Plugins Garbage Collector** – (By Vladimir Garagulya)
    13. **Really Simple SSL** – (By Rogier Lankhorst, Mark Wolters)
    14. **Widget Logic** – (By WPChef)
    15. **WP Super Cache** – (By Automattic)
    16. **WP Twitter Auto Publish** – (By xyzscripts.com)
    17. **Yoast SEO** – (By Team Yoast)
 *  -  This reply was modified 6 years ago by [onlanka](https://wordpress.org/support/users/onlanka/).
      Reason: some formatting added

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Adsense ad code bug’ is closed to new replies.

 * ![](https://ps.w.org/accelerated-mobile-pages/assets/icon-256x256.png?rev=1693616)
 * [AMP for WP - Accelerated Mobile Pages](https://wordpress.org/plugins/accelerated-mobile-pages/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/accelerated-mobile-pages/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/accelerated-mobile-pages/)
 * [Active Topics](https://wordpress.org/support/plugin/accelerated-mobile-pages/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/accelerated-mobile-pages/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/accelerated-mobile-pages/reviews/)

## Tags

 * [ad code](https://wordpress.org/support/topic-tag/ad-code/)

 * 5 replies
 * 2 participants
 * Last reply from: [onlanka](https://wordpress.org/support/users/onlanka/)
 * Last activity: [6 years ago](https://wordpress.org/support/topic/adsense-ad-code-bug/#post-12878736)
 * Status: not resolved