PHPackages                             ashhhbradley/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. ashhhbradley/adsense

ActiveKirby-plugin[Utility &amp; Helpers](/categories/utility)

ashhhbradley/adsense
====================

Display your Google AdSense analytics directly within the Kirby 3 panel.

1.0.0(5y ago)69MITPHPCI failing

Since Jul 1Pushed 5y ago1 watchersCompare

[ Source](https://github.com/AshhhBradley/kirby-adsense)[ Packagist](https://packagist.org/packages/ashhhbradley/adsense)[ RSS](/packages/ashhhbradley-adsense/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

Google AdSense Analytics for Kirby 3
====================================

[](#google-adsense-analytics-for-kirby-3)

This plugin will display your Google AdSense metrics for a range of dimensions directly from within the Kirby 3 panel.

[![Screenshot](https://user-images.githubusercontent.com/8355430/86273097-9e7b7b00-bbc7-11ea-81d1-d84aa238274e.png)](https://user-images.githubusercontent.com/8355430/86273097-9e7b7b00-bbc7-11ea-81d1-d84aa238274e.png)

Overview
--------

[](#overview)

> This plugin is completely free and published under the MIT license.

- [1. Installation](#1-installation)
- [2. Authentication](#2-authentication)
- [3. Options](#3-options)
    - [3.1. Required Options](#31-required-options)
    - [3.2. Optional](#32-optional)
- [4. Blueprints](#4-blueprints)
    - [4.1. Basic blueprint example](#41-basic-blueprint-example)
    - [4.2. Hide elements](#42-hide-elements)
    - [4.3. Defaults](#43-defaults)
    - [4.4. Filters](#44-filters)
    - [4.5. Cache](#45-cache)
    - [4.6. Params](#46-params)
    - [4.7. Complete blueprint example](#47-complete-blueprint-example)
- [5. License](#5-license)
- [6. Credits](#6-credits)

1. Installation
---------------

[](#1-installation)

Installation via Composer

```
composer require ashhhbradley/adsense

```

This will install the plugin along with it's dependencies at `/site/plugins/adsense`

> Note: If you have adblock installed you may recieve a failed to fetch error since it will block urls containing the word adsense. To fix this either disable adblock or add `@@||*/api/plugin/adsense/$xmlhttprequest` to your filters.

2. Authentication
-----------------

[](#2-authentication)

In order for this plugin to fetch data from the Google AdSense API, some credentials will need to be provided. You can follow a walk-through to learn how to create them here: [Wiki](https://github.com/AshhhBradley/kirby-adsense/wiki).

3. Options
----------

[](#3-options)

Here is an overview of the available options with their default values:

```
return [
    # required
    'ashhhbradley.adsense.client_secret'   => undefined,
    'ashhhbradley.adsense.client_id'       => undefined,
    'ashhhbradley.adsense.redirect_uri'    => undefined,

    # optional
    'ashhhbradley.adsense.token_file_path' => '/auth/token',
    'ashhhbradley.adsense.cache_file_path' => '/reports/cache/',
];
```

### 3.1. Required Options

[](#31-required-options)

#### 3.1.1. `client_secret`

[](#311-client_secret)

This is where to insert your client secret value from .

> Please note that the client secret is private and shouldn't be made public. Once added, if you need to publish your code please create something like a duplicated `config.github.php` which will contain the non-sensitive information, and add your real `config.php` to your `.gitignore`.

> More info here:

```
'ashhhbradley.adsense.client_secret' => '#########################',
```

#### 3.1.2. `client_id`

[](#312-client_id)

This is where to insert your client id value from .

> Much like the client secret, the client id should also remain private and not be made public.

```
'ashhhbradley.adsense.client_id' => 'example.apps.googleusercontent.com',
```

#### 3.1.3. `redirect_uri`

[](#313-redirect_uri)

This value should be the url of the panel page which contains the plugin. It is used for redirection after connecting your google account and just makes the authentication flow a bit more seamless.

```
'ashhhbradley.adsense.redirect_uri' => 'http(s):///panel/site',
```

### 3.2. Optional

[](#32-optional)

#### 3.2.1. `token_file_path`

[](#321-token_file_path)

> Type: `String`, Default: `/auth/token`

This is the file path for where to store the access token.

> Note: This value must start with `/` &amp; contain a directory followed by a filename.

```
'ashhhbradley.adsense.token_file_path' => '//',
```

#### 3.2.2. `cache_file_path`

[](#322-cache_file_path)

> Type: `String`, Default: `/reports/cache/`

This is the file path for where to store the json responses from the Google Adsense API.

> Note: This value must start &amp; end with `/`.

```
'ashhhbradley.adsense.cache_file_path' => '///',
```

4. Blueprints
-------------

[](#4-blueprints)

This section will cover all the available properties for this plugin and explain what each property does.

### 4.1. Basic blueprint example

[](#41-basic-blueprint-example)

> Please make sure that you have included the required options in your Kirby config and included your account ID in the blueprint.

Place this snippet in your blueprint:

```
columns:
  - width: 2/3
    sections:
      analytics:
        type: adsense
        account: "pub-################"
```

#### 4.1.1. `account` (required)

[](#411-account-required)

This is where to add your AdSense account ID. You can also query this value from a panel page field such as `{{ kirby.user.account_id }}`. This will fetch the value from a field called `account_id` for the current user.

### 4.2. Hide elements

[](#42-hide-elements)

```
  hideHeadline:    false
  hideConnect:     false
  hideLastUpdated: false
```

#### 4.2.1. `hideHeadline`

[](#421-hideheadline)

> Type: `Boolean`, Default: `false`

Setting this value to `true` will hide the default headline.

#### 4.2.2. `hideConnect`

[](#422-hideconnect)

> Type: `Boolean`, Default: `false`

After connecting your account, you may wish to hide the connect button and setting this value to `true` will do that. But remember if you wish to disconnect your account this will need to be set to false.

#### 4.2.3. `hideLastUpdated`

[](#423-hidelastupdated)

> Type: `Boolean`, Default: `false`

Setting this value to `true` will hide the last updated text below the component.

#### 4.3. Defaults

[](#43-defaults)

```
  defaults:
    active: today
    currency: USD
```

#### 4.3.1. `active`

[](#431-active)

> Type: `String`, Default: `today`

This is used to set the active date range to load when the user first loads the plugin. So if you wanted "All Time" to initially be the active date range, set this value to `all_time`.

#### 4.3.2. `currency`

[](#432-currency)

> Type: `String`, Default: `USD`

Set your currency code here, you can find a full list of currency codes over at the API docs.

See:

### 4.4. Filters

[](#44-filters)

```
  filters:
    AD_UNIT_NAME: "{{ kirby.user.ad_unit }}"
    PLATFORM_TYPE_CODE: "HighEndMobile"
```

> Type: `Array`, Default: `null`

You can filter your reports by adding dimensions and their values to the blueprint like this. Important: these values are case sensitive any may return an error if not added correctly.

See:

### 4.5. Cache

[](#45-cache)

```
  cache:
    disabled: false
    prompt: true
    refresh:
      - clearActive
      - clearAll
    autoRefresh:
      - today
    autoRefreshInterval: '12 hours'
```

#### 4.5.1. `disabled`

[](#451-disabled)

> Type: `Boolean`, Default: `false`

Setting this value to `true` will disable saving reports to file. This is not recommending as the API has a limit of 10,000 requests per day. But if you want real time updates this is how to do it. This option will also make all other options redundant when set to `true`.

#### 4.5.2. `prompt`

[](#452-prompt)

> Type: `Boolean`, Default: `true`

By default a prompt will appear asking for confirmation every time the user clicks the refresh cache button. To disable this simply set this option to `false`.

#### 4.5.3. `refresh`

[](#453-refresh)

> Type: `Array`, Default: `[hidden]`

By default the refresh button will be hidden. This property will accept the values `clearActive`, `clearAll` or both.

- `clearActive` will display a Refresh button which will only clear the cache for the active date range and fetch a new report to save to cache.
- `clearAll` will display a Clear All Cache button which will clear all reports from cache and fetch a new report for the active date range to save to cache.
- If both of these options are added, a dropdown menu will display with both options to choose from.

#### 4.5.4. `autoRefresh`

[](#454-autorefresh)

> Type: `Array`, Default: `empty`

When the page is refreshed, if the active date range is listed in this array, the last updated date will be compared to the current time and will automatically refresh the data if the refresh interval has elapsed.

#### 4.5.5. `autoRefreshInterval`

[](#455-autorefreshinterval)

> Type: `String`, Default: `12 hours`

For a full list of accepted values see the PHP documentation.

See:

### 4.6. Params

[](#46-params)

```
  params:
    today:
      name: Today
      startDate: today
      endDate: today
```

For the params you must specify a date range with a custom property name which includes the following nested properties: `name`, `startDate` &amp; `endDate`.

> Note: the property name, for example 'today' is the value to reference in the defaults &gt; active part of the blueprint as well as cache &gt; autoRefresh.

#### 4.6.1. `name`

[](#461-name)

> Type: `String`, Default: `Today`

This is the name which will appear in the tabs list above the analytics component.

#### 4.6.2. `startDate` / `endDate`

[](#462-startdate--enddate)

> Type: `String`, Default: `today`

Here you can specify either a relative date name or a date in the format of `YYYY-MM-DD`. For a full list of acceptable relative dates see the API docs.

See: [https://developers.google.com/adsense/management/reporting/relative\_dates](https://developers.google.com/adsense/management/reporting/relative_dates)

### 4.7. Complete blueprint example

[](#47-complete-blueprint-example)

Here's a complete example of how the blueprint will look with all the properties configured.

```
columns:
  - width: 2/3
    sections:
      analytics:
        type: adsense
        headline: Google AdSense Analytics

        account: "pub-################"

        hideHeadline: false
        hideConnect: false
        hideLastUpdated: false

        defaults:
          active: today
          currency: USD

        filters:
          PLATFORM_TYPE_CODE: "HighEndMobile"

        cache:
          disabled: false
          prompt: true
          refresh:
            - clearActive
            - clearAll
          autoRefresh:
            - today
          autoRefreshInterval: "12 hours"

        params:
          today:
            name: Today
            startDate: today
            endDate: today
          yesterday:
            name: Yesterday
            startDate: today-1d
            endDate: today-1d
          month:
            name: This Month
            startDate: startOfMonth
            endDate: today
          year:
            name: This Year
            startDate: startOfYear
            endDate: today
          all_time:
            name: All Time
            startDate: 2003-01-01
            endDate: today
```

5. License
----------

[](#5-license)

MIT

6. Credits
----------

[](#6-credits)

Credit to [Kirby Matomo](https://github.com/sylvainjule/kirby-matomo) by [@sylvainjule](https://github.com/sylvainjule) which was used as a learning resource and for styling of this plugin.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2143d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8355430?v=4)[ashhhbradley](/maintainers/ashhhbradley)[@AshhhBradley](https://github.com/AshhhBradley)

---

Top Contributors

[![AshhhBradley](https://avatars.githubusercontent.com/u/8355430?v=4)](https://github.com/AshhhBradley "AshhhBradley (5 commits)")

---

Tags

adsenseanalyticsdashboardkirbypanelplugin

### Embed Badge

![Health badge](/badges/ashhhbradley-adsense/health.svg)

```
[![Health](https://phpackages.com/badges/ashhhbradley-adsense/health.svg)](https://phpackages.com/packages/ashhhbradley-adsense)
```

###  Alternatives

[distantnative/retour-for-kirby

Manage redirects and track 404s right from the Kirby CMS Panel

14689.4k1](/packages/distantnative-retour-for-kirby)[arnoson/kirby-vite

Vite helper for Kirby CMS

9759.2k3](/packages/arnoson-kirby-vite)[fabianmichael/kirby-meta

Your all-in-one powerhouse for any SEO and metadata needs imaginable.

6910.7k1](/packages/fabianmichael-kirby-meta)[tobimori/kirby-tailwind-merge

Tailwind Merge for Kirby CMS

276.3k](/packages/tobimori-kirby-tailwind-merge)[mauricerenck/komments

A comment and webmention plugin for Kirby 3

501.2k1](/packages/mauricerenck-komments)[johannschopplich/kirby-seo-audit

SEO analysis powered by Yoast for Kirby CMS

102.3k](/packages/johannschopplich-kirby-seo-audit)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
