Show ads specifically for mobile or desktop devices
WordPress is a blogging platform that has a wide variety of features that make it easy for users to add content to their website. Not only is WordPress used as a blog, but there are many websites that use WordPress as a website for sales or daily news. The only thing that makes WordPress comfortable to use is that it has so many and different plugins that users can do what they want by finding and installing plugins for free.
Installing ads on WordPress can also be called easy because some advertising services have provided special plugins to serve these ads, but there are still many advertising services that don’t have plugins for WordPress and users have to install them manually. The problem is if you only want to place the ad on the website and users are currently only using one theme for PC and mobile because the theme is pretty responsive. So how do you place an ad so that it only appears on desktop or mobile?
The answer is quite simple, namely with the help of a plugin called Ad inserter. I also checked this plugin because it has very good features and is constantly updated by the creator. The only feature I like is also the auto-customizable ad placements and besides can only view these ads on desktop computers or mobile devices. In this way, users no longer have to change the theme and simply install the Ad Inserter plugin. Here is the full tutorial.
First, go to the WordPress dashboard, then install and activate the Ad Inserter plugin.
Next, go to the settings of the ad inserter. Just paste the ad code in the large column listed there.
If so, click the button device that’s at the bottom of the big column before.
Additional settings are shown below so this ad will only show on desktop or mobile devices. The trick is to check the option Use client-side detection to just click. to display and check again which devices you want to display on e.g. B. Desktop.
Not done yet, to be more specific, check out the option as well Use server-side detection to only access. to display and choose which devices to display ads on.
If so, just press the button Save all settings.
I suggest choosing the two options that seem more accurate when viewing certain ads on which device. There is also an option in this ad inserter plugin to select ads that will only show on tablets and I think tablets are still mobile devices. And if the user wants a more manual way with the intention of changing the subject directly from the editor, and wants this method without using a plugin, please copy the code below.
The above PHP code is very simple and still may not be able to fully detect mobile devices as it is only limited to the user agent. There are two ways to discover a mobile or desktop device, namely by User agent or the screen size used. But I think the user agent is enough. If you have anything to ask, please comment.
Hopefully useful and good luck