[Support request] need adjustment in hook

Home Forums Support [Support request] need adjustment in hook

Home Forums Support need adjustment in hook

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1059132
    Shivam

    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.

    #1059206
    David
    Staff
    Customer Support

    Hi there,

    Did you resolve the issue as it is working on my browsers?

    #1059279
    Shivam

    no 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…

    #1059319
    David
    Staff
    Customer Support

    You 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.

    #1059321
    Shivam

    I didn’t get it, can you please rearrange my code with the necessary tag?

    #1059340
    David
    Staff
    Customer Support

    Like 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>
    #1059363
    Shivam

    Hey if i want to add margin and keep the ad in center then what i will need to do?

    #1059380
    David
    Staff
    Customer Support

    Edit the code above to include the grid container.

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.