Change/Switch Ads Automatically for Mobile, Tablet, and Desktop on WordPress Blogs
Please Subscribe to our YouTube Channel
There are lots of bloggers and webmasters who choose to use a WordPress theme that is optimized for Desktop, Tablet, and Smartphones. It is really useful if you are the only one who manages the blog. Managing two different themes could be tough and even more time-consuming. However, you may face trouble when it comes to serving ads on your blog. Ads are the primary source of income for many bloggers and serving suitable size of ads on different platforms keep the blog look good and it also helps you meet Ad Network policy.
For example, you may want to serve a large banner (e.g.970X250) on your website for those who want to visit from computer/desktop. However, it will look awkward on mobile devices. In the same way, there are many banners that won’t be a great fit for Mobile or Desktop. So you need something that can help you define what to serve. It is for those who don’t know coding and want an easy way.
How to serve different Adsense or any other type of ads for Desktop, Mobile, and Tablet on WordPress Blogs
- Go to your WordPress Dashboard, click on Plugins option, and then click on Add Plugin
- Search for Wp Mobile Detect plugin. Install and Activate it
- Once the plugin is activated, you are all set. Please note that you are not going to get any additional option under settings or tools with the name of WP Mobile Detect. It’s all about settings things manually
After you activate the plugin, use following code to define the ad to appear on Mobile, Tablet, Desktop
Ads on Desktop Only (It won’t show up on Mobile and Tablet)
[notdevice] <Ad Tag Here> [/notdevice]
Ads on Mobile Phone Only (Won’t be displayed on Desktop and Tablet)
[phone] <Ad Tag Here> [/phone]
Ads on Tablet Only (Won’t be served on Phones and Desktop)
[tablet] <Ad Tag Here> [/tablet]
Ads on Desktop & Tablet Only (Won’t appear on Mobile Phones)
[notphone] <Ad Tag Here> [/notphone]
Ads on Mobile Phone & Tablet only (Won’t be displayed on Desktop)
[device] <Ad Tag Here> [/device]
Ads on Mobile Phone & Desktop Only (Won’t Appear on Tablet)
[nottab] <Ad Tag Here> [/nottab]
Ads on iOS Devices only
[ios] <Ad Tag Here> [/ios]
Ad on Android Devices only
[android] >Ad Tag Here [/android]
What to do when I want to serve ads on the same location but want them to change automatically depending on the device (desktop, mobile, and tab)?
For example, I want to use 3 different Adsense Ad tags, 300 x 250 for Mobile, 728 x 90 for Desktop, and Responsive Unit for Tablet. So I will prepare 3 Ad tags that will be this way.
[phone] <300 x 250 ad> [/phone]
[tablet] <responsive ad> [/tablet]
[notdevice] <728 x 90 ad> [/notdevice]
Now I will copy all three ad tags together, and then paste it where I want the ad to appear. There are three ads, but they won’t be served together on any device. It will be served depending on what device visitors are using because you have defined it.
Bonus Tip: You can use these tags for any other purpose as well. It can be used to serve content based on device. So it’s up to you what you want your visitors to see based on the device they are using.