- This topic has 7 replies, 2 voices, and was last updated 4 years, 4 months ago by David.
-
AuthorPosts
-
November 11, 2019 at 12:47 am #1059132Shivam
Hey team,
I wanted to add different Adsense code for mobile and desktop through Hook feature as I am already using page hero feature for title.
So, i added the code like this in the hook
<div class="hide-on-mobile hide-on-tablet"> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <!-- Header --> <ins class="adsbygoogle" style="display:inline-block;width:728px;height:90px" data-ad-client="ca-pub-24866347457758179588" data-ad-slot="1922343180"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> <div class="hide-on-desktop"> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <!-- Header mobile --> <ins class="adsbygoogle" style="display:inline-block;width:336px;height:280px" data-ad-client="ca-pub-248663475678179588" data-ad-slot="4861838462"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div>
but I don’t know why only desktop ad is appearing on all devices.
November 11, 2019 at 2:29 am #1059206DavidStaffCustomer SupportHi there,
Did you resolve the issue as it is working on my browsers?
November 11, 2019 at 4:30 am #1059279Shivamno i have not resolved the issue i am currently using that code via page hero… Tell me how can i use that with the hook feature as i want to use page hero for heading…
November 11, 2019 at 5:08 am #1059319DavidStaffCustomer SupportYou can try adding the hide-on-* class to the
<ins class="adsbygoogle">
element.
Generally its best practice to use responsive ads as opposed to calling two different scripts.November 11, 2019 at 5:10 am #1059321ShivamI didn’t get it, can you please rearrange my code with the necessary tag?
November 11, 2019 at 5:34 am #1059340DavidStaffCustomer SupportLike so:
<div class="grid-container"> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <!-- Header --> <ins class="adsbygoogle hide-on-mobile hide-on-tablet" style="display:inline-block;width:728px;height:90px" data-ad-client="ca-pub-24866347457758179588" data-ad-slot="1922343180"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> <div class="grid-container"> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <!-- Header mobile --> <ins class="adsbygoogle hide-on-desktop" style="display:inline-block;width:336px;height:280px" data-ad-client="ca-pub-248663475678179588" data-ad-slot="4861838462"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div>
November 11, 2019 at 6:00 am #1059363ShivamHey if i want to add margin and keep the ad in center then what i will need to do?
November 11, 2019 at 6:23 am #1059380DavidStaffCustomer SupportEdit the code above to include the grid container.
-
AuthorPosts
- You must be logged in to reply to this topic.