Download the PHP package brew-bytes/acorn-analytics without Composer

On this page you can find all versions of the php package brew-bytes/acorn-analytics. 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 acorn-analytics

Acorn Analytics

A theme-agnostic Acorn package that wires Google Tag Manager, Google Analytics 4, and Plausible into a Sage theme via one config file. Drop in your IDs, ship to production — no per-project script tag boilerplate, no staging-data pollution, no manual consent plumbing.

What it does

Installation

Add the IDs you want to your .env:

That's it — Acorn auto-discovers the provider, defaults gate to production, and only providers with non-empty IDs render.

Customizing

Publish the config:

Then edit config/analytics.php to flip flags, change environments, or wire up consent integration.

Custom events

From anywhere on the front-end:

…or from Alpine:

…or from Livewire:

The bridge dispatches to all enabled providers — gtag('event', ...) for GA4, plausible(...) for Plausible, dataLayer.push(...) for GTM — so the same event call works regardless of which provider(s) are configured.

You can also use the package's tiny PHP-free JS API:

Automatic event tracking

acorn-analytics ships an auto-tracking module that wires delegated DOM listeners for the four interactions every site ends up tracking by hand. Events flow through the same bridge as your custom events — they reach every enabled provider with no extra wiring.

Sub-feature Default Event name Sample payload
phone-clicks ✅ on phone_click { phone_number, link_text }
email-clicks ✅ on email_click { email, link_text }
file-downloads ✅ on file_download { file_url, file_extension, link_text }
scroll-depth ✅ on scroll { percent_scrolled } (one of [25, 50, 75, 100])
outbound-links ❌ off outbound_click { link_url, link_domain, link_text }

Outbound-link tracking defaults off because GA4's Enhanced Measurement already auto-collects outbound clicks (as click events with its own params). Enabling our outbound-links sub-feature ships a separate outbound_click event so the two don't collide if you happen to have both enabled.

Configure in config/analytics.php:

Set the top-level enabled to false to disable the entire module, or flip individual sub-features.

A note on PII

The default phone_click and email_click payloads include the actual phone number and email address from the clicked link's href. For a typical business site this is your own published contact info — already public HTML, not visitor PII, and safe to send to GA4.

If your site contains user-submitted phone/email links (vCard exports, marketplace seller profiles, etc.), those values would be visitor PII — and Google's no-PII rule applies. In that case, either disable the relevant sub-feature or extend the module to redact / hash values before emit.

Cookie consent integration

Set in config/analytics.php:

When consent is required, no provider scripts inject until that event fires on window. Custom events dispatched before consent are buffered and flushed on acceptance.

Compatible with most consent platforms — point event at:

Platform Event name
Custom UI cookie-consent:granted
OneTrust OneTrustGroupsUpdated
Cookiebot CookiebotOnAccept
Cookieyes cookieyes:accepted

Troubleshooting

Provider scripts aren't appearing in <head>. Most likely your environment isn't in the configured environments list. Defaults to ['production'] only. Two common surprises:

env() calls return null on a non-Bedrock WP install. The default config/analytics.php reads IDs from environment variables (env('GA4_MEASUREMENT_ID') etc.). On a vanilla WordPress install (no Bedrock .env loader), those calls return null and modules silently no-op. Either:

Provider just installed but isn't loading. Acorn caches the package manifest at wp-content/cache/acorn/framework/cache/packages.php. If composer require was run from outside a shell that has WP-CLI DB access (common on Local-by-Flywheel), the post-autoload-dump's cache invalidation silently fails. Delete that file plus its sibling services.php to force a rebuild.

What it doesn't do

Requirements

License

MIT © Brew & Bytes


All versions of acorn-analytics with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
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 brew-bytes/acorn-analytics contains the following files

Loading the files please wait ...