[Support request] Show different adverts to mobile and desktop users

Home Forums Support [Support request] Show different adverts to mobile and desktop users

Home Forums Support Show different adverts to mobile and desktop users

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1004694
    Adam

    Hello,

    We use the elements options in the Generate Press theme to show adverts on our site. Is there any way to create elements that detect the users device and show diffent styled adverts based on the device they are using (e.g. desktop and mobile)?

    Many thanks!

    Adam

    #1004706
    David
    Staff
    Customer Support

    Hi there,

    Are you using an Ad services such as Adsense ? If so then you would choose a responsive ad format. Using PHP to select a different advert is a bit hit and miss.

    #1005534
    Adam

    Thanks David.

    The adverts are direct from clients rather than AdSense. So a 728 x 90 header image looks good on desktop but not so good on mobile.

    #1005595
    David
    Staff
    Customer Support

    How are the adverts provided? Is it just a block of HTML and CSS?

    #1005638
    Adam

    Hi David. Yes it’s just a block of html and CSS

    #1005646
    David
    Staff
    Customer Support

    The simplest but not necessarily the most efficient way is to add all the various HTML blocks for each advert size and add the hide-on- classes to leave the one you want displayed on each device:

    https://docs.generatepress.com/article/responsive-display/#using-our-hide-on-classes

    #1005648
    Adam

    Thank you!

    #1005670
    David
    Staff
    Customer Support

    You’re welcome

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