Contensio logo

Ads Management

Manage ad zones, rotate ad blocks by weight, schedule campaigns, and track impressions and clicks. Supports image banners, raw HTML/JavaScript snippets, and Google AdSense units.

About this plugin

Ads Manager — Contensio Plugin

Manage ad zones, rotate ad blocks by weight, schedule campaigns, and track impressions and clicks. Supports image banners, raw HTML/JavaScript snippets, and Google AdSense units.

Features

  • Ad zones — named placement areas identified by a slug (e.g. sidebar-top, after-content)
  • Three placement modes — manual (call from template), after paragraph N, or any registered hook point
  • Ad blocks — image, HTML/script, or Google AdSense per zone; multiple blocks rotate by weight
  • Scheduling — optional start and end dates per block; blocks outside their window are silently skipped
  • Weighted rotation — assign higher weight to blocks that should appear more often
  • Impression and click tracking — atomic counters; click tracking via redirect (/ads/c/{id})
  • Reports dashboard — all-time stats per block with CTR; overall summary totals
  • Settings hub card — quick stats in the admin settings hub

Requirements

  • Contensio CMS core
  • PHP 8.2+
  • Laravel 11+

Installation

  1. Require the package:

    composer require contensio/plugin-ads-manager
    
  2. Run migrations:

    php artisan migrate
    
  3. The plugin registers itself automatically via the Contensio plugin system.

Usage

Manual placement (in a Blade template)

{!! \Contensio\AdsManager\Support\AdManager::render('sidebar-top') !!}

Replace sidebar-top with the slug of your ad zone.

After paragraph injection

When creating or editing a zone, set Placement to After paragraph and enter the paragraph number. The plugin hooks into contensio/content/body and injects the ad after the Nth closing </p> tag in post content automatically.

Hook-based placement

Set Placement to Hook and enter any registered CMS hook name (e.g. contensio/frontend/post-after-content). The ad renders wherever that hook fires.

Ad block types

Type Description
Image An <img> tag rendered from a URL; optionally wrapped in a click-tracking link
HTML / Script Raw HTML or JavaScript pasted directly, rendered as-is
Google AdSense Paste your AdSense <ins> unit; impression tracking is skipped (Google handles it)

Click tracking

Clicks are tracked via a redirect: /ads/c/{blockId}. The block's click_count is incremented atomically, then the visitor is redirected to the destination URL (302). This route requires no authentication.

Data storage

Table Description
contensio_ad_zones Zone definitions: name, slug, placement config
contensio_ad_blocks Block content, weight, schedule, impression and click counters

License

AGPL-3.0-or-later. See LICENSE.