PHPackages                             geertw/yii2-adsense - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. geertw/yii2-adsense

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

geertw/yii2-adsense
===================

Widget for displaying Google AdSense banners

v1.0.2(8y ago)23.9k1[1 issues](https://github.com/geertw/yii2-adsense/issues)MITPHP

Since Jan 16Pushed 8y ago2 watchersCompare

[ Source](https://github.com/geertw/yii2-adsense)[ Packagist](https://packagist.org/packages/geertw/yii2-adsense)[ RSS](/packages/geertw-yii2-adsense/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (3)Dependencies (1)Versions (4)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/7810be8df2e08fc5476fc72490ef7f29830c9657ec64a089c369c38e906d2d47/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6765657274772f796969322d616473656e73652e737667)](https://packagist.org/packages/geertw/yii2-adsense)[![Total Downloads](https://camo.githubusercontent.com/912e0519971982df5ab43edff35dcc2ebaed72cf53e278e96e61d1504b4dc029/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6765657274772f796969322d616473656e73652e737667)](https://packagist.org/packages/geertw/yii2-adsense)[![License](https://camo.githubusercontent.com/84a859fdd85d501f077ffd8d1e7d5db99eea5eec95376b621e5ecb76faade60e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6765657274772f796969322d616473656e73652e737667)](https://packagist.org/packages/geertw/yii2-adsense)

Google AdSense widget
=====================

[](#google-adsense-widget)

Yii2 widget for displaying Google AdSense banners. This widget provides a convenient method for displaying Adsense banners in Yii2 templates.

This widget also makes it easy to disable Adsense, which can be useful for development. When disabled, this widget shows a dummy banner with the actual banner size and an indication whether this is a valid banner size for AdSense.

[![Example](example.png)](example.png)

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
composer require geertw/yii2-adsense

```

or add

```
"geertw/yii2-adsense": "*"

```

to the require section of your `composer.json` file.

Configuration
-------------

[](#configuration)

You may configure application-wide settings using Yii2 params, or you can configure the widget per instance.

You must configure the settings `client`, `slot` and `enabled` in order to display banners.

In your params configuration:

```

```

If you want a non-default slot ID, or when you want to change other settings, use:

```
