PHPackages                             tightenco/nova-google-analytics - 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. tightenco/nova-google-analytics

ActiveLibrary

tightenco/nova-google-analytics
===============================

Google Analytics integration with Nova

v4.0.0(2y ago)166127.8k↓30%30[1 PRs](https://github.com/tighten/nova-google-analytics/pulls)2MITPHPPHP ^8.1

Since Aug 24Pushed 1y ago11 watchersCompare

[ Source](https://github.com/tighten/nova-google-analytics)[ Packagist](https://packagist.org/packages/tightenco/nova-google-analytics)[ Docs](https://github.com/tightenco/nova-google-analytics)[ RSS](/packages/tightenco-nova-google-analytics/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (22)Used By (2)

[![image](https://user-images.githubusercontent.com/4378273/214305768-9177e8ad-e6e2-4ee7-8b49-f9672361d598.png)](https://user-images.githubusercontent.com/4378273/214305768-9177e8ad-e6e2-4ee7-8b49-f9672361d598.png)

Google Analytics Integration with Nova
======================================

[](#google-analytics-integration-with-nova)

[![Latest Version on Packagist](https://camo.githubusercontent.com/e619160576f5ac1ddc602ea4af363bf7f563394466bf43289bc09d3f1223b0be/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7469676874656e636f2f6e6f76612d676f6f676c652d616e616c79746963732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tightenco/nova-google-analytics)[![Total Downloads](https://camo.githubusercontent.com/163c9eac2fe694901b682c779806c919d25eafb26cd3bd8e6ce0e627ba89b53e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7469676874656e636f2f6e6f76612d676f6f676c652d616e616c79746963732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tightenco/nova-google-analytics)[![Build Status](https://github.com/tighten/nova-google-analytics/actions/workflows/run-tests.yml/badge.svg)](https://github.com/tighten/nova-google-analytics/actions/workflows/run-tests.yml/badge.svg)

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

[](#installation)

You can install the package in to a Laravel app that uses [Nova](https://nova.laravel.com) via composer:

```
composer require tightenco/nova-google-analytics
```

For now, follow the directions on [Spatie's Laravel Google Analytics package](https://github.com/spatie/laravel-analytics) for getting your credentials, then put them here:

```
yourapp/storage/app/analytics/service-account-credentials.json

```

Also add this to the `.env` for your Nova app:

```
ANALYTICS_PROPERTY_ID=
```

Upgrading to 4.0
----------------

[](#upgrading-to-40)

Version 4.0 uses the new Google Analytics 4 Data API.

- Upgrades `spatie/laravel-analytics` to `v5.2`
    - Drops support for PHP 8.0
    - Drops support for Laravel 9
- Removes `FourteenDayActiveUsersMetric` metric which is not available in GA4

The required environment variable `ANALYTICS_VIEW_ID` has been renamed to `ANALYTICS_PROPERTY_ID` to match Google's usage.

Usage
-----

[](#usage)

You must register the cards you want to display with Nova. This is typically done in the `cards` method of the `Main`dashboard.

```
// in app/Nova/Dashboards/Main.php

// ...

public function cards()
{
    return [
        // ...
        new \Tightenco\NovaGoogleAnalytics\PageViewsMetric,
        new \Tightenco\NovaGoogleAnalytics\VisitorsMetric,
        new \Tightenco\NovaGoogleAnalytics\MostVisitedPagesCard,
        new \Tightenco\NovaGoogleAnalytics\ReferrersList,
        new \Tightenco\NovaGoogleAnalytics\OneDayActiveUsersMetric,
        new \Tightenco\NovaGoogleAnalytics\SevenDayActiveUsersMetric,
        new \Tightenco\NovaGoogleAnalytics\TwentyEightDayActiveUsersMetric,
        new \Tightenco\NovaGoogleAnalytics\SessionsMetric,
        new \Tightenco\NovaGoogleAnalytics\SessionDurationMetric,
        new \Tightenco\NovaGoogleAnalytics\SessionsByDeviceMetric,
        new \Tightenco\NovaGoogleAnalytics\SessionsByCountryMetric,
    ];
}
```

Register the tool with Nova in the `tools` method of your `NovaServiceProvider`:

```
// in app/Providers/NovaServiceProvider.php

// ...

public function tools()
{
    return [
        new Tightenco\NovaGoogleAnalytics\Tool(),
    ];
}
```

Features
--------

[](#features)

#### View the Visitors and Pageview Metrics

[](#view-the-visitors-and-pageview-metrics)

[![image](https://user-images.githubusercontent.com/7070136/179579307-e61c4fe4-0e70-482d-8939-3a47bc90b604.png)](https://user-images.githubusercontent.com/7070136/179579307-e61c4fe4-0e70-482d-8939-3a47bc90b604.png)

#### View the Active Users Metrics

[](#view-the-active-users-metrics)

[![image](https://user-images.githubusercontent.com/7070136/179579376-06054344-ae64-4452-913b-2196f744f41c.png)](https://user-images.githubusercontent.com/7070136/179579376-06054344-ae64-4452-913b-2196f744f41c.png)

#### View the Sessions and Avg. Session Duration Metrics

[](#view-the-sessions-and-avg-session-duration-metrics)

[![image](https://user-images.githubusercontent.com/7070136/179579480-e2e9cbc6-beea-47d8-9268-a68eac90a436.png)](https://user-images.githubusercontent.com/7070136/179579480-e2e9cbc6-beea-47d8-9268-a68eac90a436.png)

#### View the Devices and Country Metrics by Session

[](#view-the-devices-and-country-metrics-by-session)

[![image](https://user-images.githubusercontent.com/7070136/179579608-61cde3e7-4159-4025-a925-3a2940e94ed6.png)](https://user-images.githubusercontent.com/7070136/179579608-61cde3e7-4159-4025-a925-3a2940e94ed6.png)

#### View the lists of Most Visited Pages and Referrers

[](#view-the-lists-of-most-visited-pages-and-referrers)

[![image](https://user-images.githubusercontent.com/7070136/179579542-9e60e6a4-53d6-4d40-a9f9-d9aeb3cec791.png)](https://user-images.githubusercontent.com/7070136/179579542-9e60e6a4-53d6-4d40-a9f9-d9aeb3cec791.png)

Testing
-------

[](#testing)

First, copy your .env.example file to a new file called .env.testing:

```
cp .env.example .env.testing

```

Make sure, in that file, to define the following variables to run all tests:

```
ANALYTICS_PROPERTY_ID
ANALYTICS_PROJECT_ID
ANALYTICS_PRIVATE_KEY_ID
ANALYTICS_PRIVATE_KEY
ANALYTICS_CLIENT_EMAIL_KEY
ANALYTICS_CLIENT_ID
ANALYTICS_CLIENT_CERT_URL

```

Add the `.env.testing` file in `.gitignore` so you can safely use the same analytics view ID to run the tests that you use for the card.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Matt Stauffer](https://github.com/mattstauffer)
- [Kristin Collins](https://github.com/krievley)
- [All Contributors](https://github.com/tighten/nova-google-analytics/graphs/contributors)

Support us
----------

[](#support-us)

Tighten is a web development firm that works in Laravel, Vue, and React. You can learn more about us on our [web site](https://tighten.com/)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance26

Infrequent updates — may be unmaintained

Popularity48

Moderate usage in the ecosystem

Community28

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

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

Every ~112 days

Recently: every ~213 days

Total

19

Last Release

795d ago

Major Versions

v0.3.2 → v1.0.02021-11-13

v1.0.1 → v2.0.02022-02-11

v2.0.0 → v3.0.02022-07-25

v3.0.0 → v4.0.02024-03-14

PHP version history (5 changes)v0.1.0PHP &gt;=7.1.0

v0.3.2PHP ^7.3|^8.0

v2.0.0PHP ^8.0

v3.0.0PHP ^8.0|^8.1

v4.0.0PHP ^8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/151829?v=4)[Matt Stauffer](/maintainers/mattstauffer)[@mattstauffer](https://github.com/mattstauffer)

---

Top Contributors

[![mattstauffer](https://avatars.githubusercontent.com/u/151829?v=4)](https://github.com/mattstauffer "mattstauffer (35 commits)")[![driftingly](https://avatars.githubusercontent.com/u/194221?v=4)](https://github.com/driftingly "driftingly (15 commits)")[![krievley](https://avatars.githubusercontent.com/u/7070136?v=4)](https://github.com/krievley "krievley (14 commits)")[![tonysm](https://avatars.githubusercontent.com/u/1178621?v=4)](https://github.com/tonysm "tonysm (11 commits)")[![lalarukh1](https://avatars.githubusercontent.com/u/35193027?v=4)](https://github.com/lalarukh1 "lalarukh1 (3 commits)")[![dmyers](https://avatars.githubusercontent.com/u/207171?v=4)](https://github.com/dmyers "dmyers (1 commits)")[![wilburpowery](https://avatars.githubusercontent.com/u/15817188?v=4)](https://github.com/wilburpowery "wilburpowery (1 commits)")[![faxblaster](https://avatars.githubusercontent.com/u/4378273?v=4)](https://github.com/faxblaster "faxblaster (1 commits)")[![jasonlbeggs](https://avatars.githubusercontent.com/u/25065083?v=4)](https://github.com/jasonlbeggs "jasonlbeggs (1 commits)")[![m-a-k-o](https://avatars.githubusercontent.com/u/6873535?v=4)](https://github.com/m-a-k-o "m-a-k-o (1 commits)")[![mbardelmeijer](https://avatars.githubusercontent.com/u/1583095?v=4)](https://github.com/mbardelmeijer "mbardelmeijer (1 commits)")

---

Tags

phplaravelnovatightennova-google-analytics

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/tightenco-nova-google-analytics/health.svg)

```
[![Health](https://phpackages.com/badges/tightenco-nova-google-analytics/health.svg)](https://phpackages.com/packages/tightenco-nova-google-analytics)
```

###  Alternatives

[bezhansalleh/filament-google-analytics

Google Analytics integration for FilamentPHP

205144.8k5](/packages/bezhansalleh-filament-google-analytics)[tightenco/nova-stripe

A tool to create a quick Stripe dashboard in your Laravel Nova admin panels

110308.9k](/packages/tightenco-nova-stripe)[inani/nova-resource-maker

A Laravel Nova package to help you generate resources fields

2513.7k](/packages/inani-nova-resource-maker)[cybercog/laravel-nova-ban

A Laravel Nova banning functionality for your application.

40199.8k](/packages/cybercog-laravel-nova-ban)

PHPackages © 2026

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