Family Encyclopedia >> Electronics

How to show ads only for search engine visitors in WordPress

Based on our experience and research from many industry experts, it appears that search engine visitors are more likely to click on specific ads than their regular readers. In this article, we will share a technique that will allow you to earn more money from your blogs by simply showing ads to your search engine visitors ONLY. While your regular visitors do not see these ads. This works great with specific pay-per-click (PPC) ad units, like Google Adsense.

Note:The technique shown in this article can be used to display content other than ads that target search engine visitors to your site. Perhaps a special discount code, welcome message, etc.

The first thing you need to do is open the functions.php file and paste the following code:

$ ref = $ _SERVER ['HTTP_REFERER']; $ SE = array ('/ search?', 'Images.google.', 'Web.info.com', 'search.', 'Del.icio.us/search', 'soso.com', '/ search / ',' .yahoo. '); foreach ($ SE como $ source) if (strpos ($ ref, $ source)! == false) setcookie ("sevisitor", 1, time () + 3600, "/", ".wpbeginner.com") ; $ sevisitor = true; función wpbeginner_from_searchengine () global $ sevisitor; if ($ sevisitor == true || $ _COOKIE ["sevisitor"] == 1) return true; falso retorno; 

Note:In the setcookie line, make sure to change .wpbeginner.com to your own site domain.

Then just open the place where you want to place this ad or special content (mainly in single.php, however it can be any other file like sidebar.php etc) and paste the following:

 INSERTE SU CÓDIGO AQUÍ 

The above code checks if the Referrer is from any type of search URL which includes Google, Yahoo, Delicious, etc. If a visitor's browser says that the Referring Agent is from any search site we have specified, it will store a cookie on their browser called 'sevisitor' for a duration of 1 hour from the time they visited your site. Most search visitors don't go to the second page, but if your site is optimized to increase page views or has interesting content, they will visit additional pages. In that case, WordPress will display the search engine-specific ad you've specified for these users for one hour from when they first visited your site. If this user bookmarks your site and comes back a day later because they like your site, they will be considered your regular reader and will not see the search engine specific content.

We hope you will use this code to increase advertising revenue. Feel free to share this article with your friends if you like it.

Source:Scratch99