⬆️ ⬇️

Google adsense for mobile





Well, here comes the Russian AdSense for mobile devices. This miracle works in almost the same way as AdSense for the web. The only difference is that AdSense for web uses javascript, and AdSense for mobiles works using programming languages:



- PHP version 4.3.0 or newer

- CGI / Perl version 5.8 or newer

- JSP version 1.2 or higher

- ASP version 3.0 or newer


Unlike the regular version in the mobile, you can install no more than one ad unit per page, in which one or two advertisements can be turned (your choice).





At the same time, if you install the AdSense wap block on your website, then the ads will not appear.

')





From the available settings, you can also select markup: wml, xhtml or chtml ( I do not know this layout and I already know such markup ). However, if your site can change the layout of pages depending on which device the visitor came from, it will not be difficult for you to set up the layout of ad units automatically: a variable is responsible for outputting one or another mark, the value of which is simply enough to change directly on your site.



Well, of course there is an opportunity to customize the color palette - border, link, background, text - and channels.



Personal experience

At the moment, put the mobile version on one site. Used PHP code. The code was like this:

$ GLOBALS ['google'] ['ad_type'] = 'text';

$ GLOBALS ['google'] ['channel'] = '***';

$ GLOBALS ['google'] ['client'] = '***';

$ GLOBALS ['google'] ['format'] = 'mobile_single';

$ GLOBALS ['google'] ['https'] = $ _ SERVER ['HTTPS'];

$ GLOBALS ['google'] ['host'] = $ _ SERVER ['HTTP_HOST'];

$ GLOBALS ['google'] ['ip'] = $ _ SERVER ['REMOTE_ADDR'];

$ GLOBALS ['google'] ['markup'] = 'wml';

$ GLOBALS ['google'] ['output'] = 'wml';

$ GLOBALS ['google'] ['ref'] = $ _ SERVER ['HTTP_REFERER'];

$ GLOBALS ['google'] ['url'] = $ _ SERVER ['HTTP_HOST']. $ _SERVER ['REQUEST_URI'];

$ GLOBALS ['google'] ['useragent'] = $ _ SERVER ['HTTP_USER_AGENT'];

require ('http://pagead2.googlesyndication.com/pagead/show_ads.php');


However, the installation immediately encountered errors with two variables:

$ GLOBALS ['google'] ['https'] = $ _ SERVER ['HTTPS'];

$ GLOBALS ['google'] ['ref'] = $ _ SERVER ['HTTP_REFERER'];


Since the $ _SERVER ['HTTPS'] and $ _SERVER ['HTTP_REFERER'] variables were missing, a corresponding error was issued. I had to tweak the code a bit:

$ GLOBALS ['google'] ['https'] = isset ($ _ SERVER ['https'])? $ _SERVER ['https']: '';

$ GLOBALS ['google'] ['ref'] = isset ($ _ SERVER ['HTTP_REFERER'])? $ _SERVER ['HTTP_REFERER']: '';


Then it all worked. True, the ads have not yet seen. In the AdSense settings about this says: "As soon as the code is added to the WAP-site, within 48 hours relevant ads should appear on it." I will wait :)



PS If someone has experience installing code in languages ​​other than PHP, and you have any problems, write how you handled them. I think the other will be very interesting.



Update

By the way, judging by this parameter $ GLOBALS ['google'] ['ad_type'] = 'text', in the future not only text, but also image ads will be available.



Update 2

Here are the first swallows. Found two problems:

1. The & sign is transmitted in the URL of the advertising link in an explicit form. And this means that in Opera Mini, for example, the site will produce a markup error. In general, it is a joint.

2. Encoding is transmitted as UTF-8. On the one hand it is good. But on the other hand, if the site is working in PHP, for example, using ob_start () and further conversion of WINDOWS-1251 to UTF-8, then the encoding of the ad breaks and shows zakaryuchki.



Update 3

I also discovered that the ad on the exit is already placed in <p> Ad </ p>. Vap masters know what it means :)

Source: https://habr.com/ru/post/14190/



All Articles