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.

Requirements

  • Yii2
  • Google AdSense account

Installation

Install with composer:

composer require geertw/yii2-adsense

Usage

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(); ?>
</div>

See the project page for more documentation.

Resources

0 0
2 followers
146 downloads
Yii Version: 2.0
License: MIT
Category: User Interface
Developed by: djiwie
Created on: Jan 16, 2017
Last updated: 7 years ago

Downloads

show all

Related Extensions