Nova Google Analytics

tightenco/nova-google-analytics image

Nova Google Analytics stats

Downloads
106.2K
Stars
161
Open Issues
2
Forks
28

View on GitHub →

Google Analytics integration with Nova

Google Analytics Integration with Nova

Installation

You can install the package in to a Laravel app that uses Nova via composer:

composer require tightenco/nova-google-analytics

For now, follow the directions on Spatie's Laravel Google Analytics package 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_VIEW_ID=

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\FourteenDayActiveUsersMetric,
new \Tightenco\NovaGoogleAnalytics\TwentyEightDayActiveUsersMetric,
new \Tightenco\NovaGoogleAnalytics\SessionsMetric,
new \Tightenco\NovaGoogleAnalytics\SessionDurationMetric,
new \Tightenco\NovaGoogleAnalytics\SessionsByDeviceMetric,
new \Tightenco\NovaGoogleAnalytics\SessionsByCountryMetric,
];
}

Features

View the Visitors and Pageview Metrics

View the Active Users Metrics

View the Sessions and Avg. Session Duration Metrics

View the Devices and Country Metrics by Session

View the lists of Most Visited Pages and Referrers

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_VIEW_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

Please see CONTRIBUTING for details.

Security

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

Credits

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

License

The MIT License (MIT). Please see License File for more information.

tighten photo

We're not here anymore! We're at github.com/tighten

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.


Tightenco Nova Google Analytics Related Articles

Nova Packages image

Nova Packages

Read article
Statamic logo

Statamic

The drop-in ready Laravel CMS you’re been waiting for. Go full-stack or headless, flat file or database – it’s up to you.

Statamic
LoadForge logo

LoadForge

Scalable load testing for web apps & APIs. Simulate real-world traffic and identify breaking points and performance limits with powerful, scalable load tests designed for Laravel.

LoadForge
Curotec logo

Curotec

World class Laravel experts with GenAI dev skills. LATAM-based, embedded engineers that ship fast, communicate clearly, and elevate your product. No bloat, no BS.

Curotec
Blastup logo

Blastup

Blastup provides social media enhancement services including buying Instagram likes, followers, and views, with features like instant delivery and a variety of packages to suit different needs.

Blastup
Typesense Search logo

Typesense Search

Typesense is an open source, blazing-fast search engine, optimized for helping you build delightful search experiences for your sites and apps. Natively integrated with Laravel Scout.

Typesense Search
Tighten logo

Tighten

We help companies turn great ideas into amazing apps, products, and services.

Tighten