Giter Club home page Giter Club logo

nova-google-analytics's Introduction

image

Google Analytics Integration with Nova

Latest Version on Packagist Total Downloads Build Status

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 NovaServiceProvider.

// in app/Providers/NovaServiceProvider.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

image

View the Active Users Metrics

image image

View the Sessions and Avg. Session Duration Metrics

image

View the Devices and Country Metrics by Session

image

View the lists of Most Visited Pages and Referrers

image

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 [email protected] 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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.