Download the PHP package corporateip/statamic-insights without Composer

On this page you can find all versions of the php package corporateip/statamic-insights. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package statamic-insights

Statamic Insights

First-party analytics for Statamic 6 with a full Control Panel dashboard. By Corporate IP.

Installing into a site

  1. composer require corporateip/statamic-insights
  2. php artisan migrate (creates the hits + daily rollup tables).
  3. Add the tracker to the site layout, just before </body> (see below).
  4. php artisan insights:geo-update once for country stats (refreshes itself monthly).
  5. Grant editors the View Insights permission; optionally add the dashboard widget to config/statamic/cp.php: ['type' => 'insights', 'width' => 100].

The tracker and cookie consent

The minimal setup is just:

This runs in anonymous mode: every pageview is counted, but no cookies are set and nobody is tracked individually. The dashboard then shows pageviews, pages, referrers, countries and devices, but "unique visitors" and "sessions" stay at zero.

To unlock visitor and session stats, Insights needs to know when a visitor has accepted cookies. It never decides that itself: your cookie banner stays in charge, and Insights only listens. There are two ways to tell it, and a typical site wires both:

1. The consent_getter parameter. Name a global JavaScript function that answers the question "are cookies allowed right now?". The tracker calls it on every pageview and treats true or the string 'accepted' as a yes. For example, if your banner stores the visitor's choice in localStorage:

then this is the whole integration:

Visitors whose getter answers yes get a first-party visitor cookie (13 months) and a rolling 30-minute session cookie; everyone else keeps being counted anonymously.

2. The window._insights.consent() call. The getter only runs on the next pageview, so the page where someone clicks Accept would not react until they navigate. To apply a choice instantly, call the tracker directly from the banner's button handlers:

consent(false) also covers withdrawal: if a visitor changes their mind later, the cookies are removed on the spot and that visitor goes back to anonymous counting.

In short: the getter covers every future pageview, the direct call makes the current page react immediately.

Maintenance is self-scheduled (needs the standard schedule:run cron): nightly insights:rollup aggregates hits into daily tables and prunes raw rows past retention_days (default 90, clamped to a minimum of 90 - aggregates are kept forever), monthly insights:geo-update. Disable with INSIGHTS_SCHEDULE=false to schedule manually.

Two things worth knowing:

Goals, events and reports

Goals live in the CP (Insights → cog icon, needs the Configure Insights permission) and are stored in content/insights/goals.yaml. Three types:

Email reports (same settings screen): weekly and/or monthly digest to any addresses - recipients don't need a CP account.

Popular entries on the front end:

Excluding yourselves: logged-in CP users are never counted (disable via insights.exclude_cp_users), IPs can be listed in insights.exclude_ips, and any individual browser opts out with localStorage.setItem('insights_ignore', 'true').

Languages

The dashboard and widget render in the language each CP user has set (their Statamic locale preference, falling back to the app locale) - not just the site default. That covers UI labels, chart date labels, number formatting and localized country names, including right-to-left languages (Arabic, Persian).

Insights ships translations for every language Statamic itself ships: ar, az, cs, da, de, de_CH, es, et, fa, fr, hu, id, it, ja, ms, nb, nl, pl, pt, pt_BR, ru, sl, sv, tr, uk, vi, zh_CN, zh_TW (English is the source language). Untranslated locales fall back to English.

To override a string (or add a locale we don't ship), put the English source string as a key in your app's own lang/{locale}.json - app translations win over the addon's:

tests/TranslationsTest.php enforces that every locale file stays complete, so a new UI string cannot ship half-translated.

Credits

Tests

Local development

After every npm run build, the consuming site serves a published copy of the assets - refresh it there or the CP keeps loading the previous bundle:

Consume from a site via a composer path repository:


All versions of statamic-insights with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
jaybizzle/crawler-detect Version ^1.3
maxmind-db/reader Version ^1.11
statamic/cms Version ^6.19
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package corporateip/statamic-insights contains the following files

Loading the files please wait ...