Forum Moderators: martinibuster

Message Too Old, No Replies

Need code for AMP Ads in Website

         

ali27386

7:38 pm on Feb 19, 2018 (gmt 0)

5+ Year Member



I am using code from support.google for How to create an AMP-compatible ad unit.
As mentioned there I added html script on header between <head>****</head> first then paste amp ad code accordingly but it work for a day then amp ad code get remove from post.

I am using this code for amp-ad
<amp-ad width=300 height=200
Type="adsense"
data-ad-client="ca-pub-****** "
data-ad-slot=" ********">
</am-ad>

Can anybody tell me whats wrong with code or right way to implement it on code

not2easy

9:00 pm on Feb 19, 2018 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



If that's not a typo, it appears your closing tag would not work with the opening tag:
<amp-ad etc...
</am-ad>

ali27386

6:39 am on Feb 20, 2018 (gmt 0)

5+ Year Member



yes it just a typo thats not the reason I guess.
I have tried this amp-ad code in adsense code <script></script>
and after that script but its gone after few hours

NickMNS

1:41 pm on Feb 20, 2018 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I have tried this amp-ad code in adsense code <script></script>

The code should NOT be in a <script> tag. It should be used like any other HTML tag.

after that script but its gone after few hours

What exactly do you mean by "its gone"? Is it that the ads no longer appear or the script is no longer on the page?

If ads are not appearing, one possible explanation is that you are not using a standard ad unit size. There may not be sufficient demand to fill ad request for an odd sized ad. I recommend you use a standard ad size if possible width=300 x height=250 instead of 200.

ali27386

10:06 am on Feb 22, 2018 (gmt 0)

5+ Year Member



What exactly do you mean by "its gone"? Is it that the ads no longer appear or the script is no longer on the page?


yes both no longer appear. I posted ame-ad code after adsense code script. but it just stay for a day after that ads get disappear and amp-ad script also disappear when I check it in code.

I am not using any plug on Wordpress just adding code directly in post from TEXT option. Now it just allowing me to add amp-ad code in one post only if I am adding in multiple post its doesn't work. Its working only for single post.

NickMNS

12:47 pm on Feb 22, 2018 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I posted amp-ad code after adsense code script.

You only post the amp script in the <amp ad> tags, like you show in your OP. No AdSense code.

As for the implementation within WordPress I have no idea, hopefully someone more knowledgeable on that topic can chime in.