MadMikeyB / FathomStatsDisplay

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fathom Stats Display

A Laravel Nova Card to show Fathom Analytics stats.

Status License PHP Latest Version on Packagist Downloads


Table of Contents

Getting Started

You'll need a Fathom account - if you don't have one, feel free to use our referal code: https://usefathom.com/ref/BYODNP - you'll get $10 off your first invoice and we get a little something too

Prerequisites

This package requires the following :

  • PHP 8.0 or higher
  • Laravel Nova 4.0 or higher
  • Fathom account with API access

Installing

To get started, you will need to install the following dependencies :

composer require charlielangridge/fathom-stats-display

Next add your Fathom API Token and Site ID to your .env file

FATHOM_SITE_ID=
FATHOM_TOKEN=

Publish the included config file:

php artisan vendor:publish --provider="CharlieLangridge\FathomStatsDisplay\CardServiceProvider"

That's it, you're ready to go!

Usage

Add the card to any of your dashboards

<?php

namespace App\Nova\Dashboards;

use CharlieLangridge\FathomStatsDisplay\FathomStatsDisplay;
use Laravel\Nova\Dashboards\Main as Dashboard;

class Main extends Dashboard
{
    /**
     * Get the cards for the dashboard.
     *
     * @return array
     */
    public function cards()
    {
        return [
            (new FathomStatsDisplay)->entityId(),
        ];
    }
}

You can pass an optional Fathom Site ID to the card's entityId() method, but it must be one your API key has access to (e.g. you have multiple fathom sites and want to show multiple different analytics cards on your dashboard). If left empty, it will default to the Site ID you have defined in your .env file.

Stats are cached for an hour, but can be refreshed with the on-card link. The time period for the stats is selectable with the drop-down.

Authors

Contributors

License

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

About


Languages

Language:PHP 63.0%Language:Vue 28.9%Language:JavaScript 8.0%Language:CSS 0.2%