yii2-adsense Widget for displaying Google AdSense banners

  1. Requirements
  2. Installation
  3. Usage
  4. Resources

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.


  • Yii2
  • Google AdSense account


Install with composer:

composer require geertw/yii2-adsense


Configure Yii params like follows:

return [
    'adsense' => [
        'client'  => 'ca-pub-1234567890123456',
        'slot'    => '1234567890',
        'enabled' => true,

Use it in your views like this:

<div style="width: 728px; height: 90px">
    <?= \geertw\Yii2\Adsense\AdsenseWidget::widget(); ?>

See the project page for more documentation.


0 0
1 follower
Yii Version: 2.0
License: MIT
Category: User Interface
Developed by: djiwie
Created on: Jan 16, 2017
Last updated: a year ago


show all

Related Extensions