Download the PHP package sidecar/craft-ga without Composer

On this page you can find all versions of the php package sidecar/craft-ga. 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 craft-ga

Craft GA

Google Analytics 4 dashboard plugin for Craft CMS 5.

Packagist Version License

Features

Requirements

Installation

Or install via the Craft CMS Plugin Store.

Upgrading from 1.x

Version 2.0.0 renamed this plugin from sidecar/craft-analytics to sidecar/craft-ga and changed its handle. Because Craft keys plugin settings by handle, upgrading does not carry your settings over — you will need to reconnect Google and re-enter your GA4 property ID. See the upgrade steps in the changelog.

Google Cloud Setup

  1. Go to Google Cloud Console
  2. Create or select a project
  3. Enable the Google Analytics Data API and the Google Search Console API (APIs & Services > Library)
  4. Create OAuth 2.0 credentials:
    • Go to APIs & Services > Credentials
    • Click Create Credentials > OAuth client ID
    • Application type: Web application
    • Add the Authorized redirect URI shown in the plugin settings page
  5. Copy the Client ID and Client Secret

Plugin Configuration

  1. Go to Settings > Plugins > Analytics in the Craft CP
  2. Enter your GA4 Property ID (numeric ID from GA4 Admin > Property Settings, e.g. 123456789)
  3. Enter your OAuth Client ID and OAuth Client Secret
  4. Click Save
  5. Click Connect to Google and authorize access
  6. Back on the settings page, copy the refresh token line shown once into your .env file (GA4_OAUTH_REFRESH_TOKEN="...") and reload the page
  7. You're connected — visit the Analytics section in the CP sidebar

The plugin never stores the refresh token itself: the setting only holds a $GA4_OAUTH_REFRESH_TOKEN reference, so the secret stays out of config/project/ and version control. Access tokens are short-lived and are derived from the refresh token on the fly, so nothing token-related is persisted.

Environment Variables

All settings support environment variables:

Then in plugin settings, use $GA4_PROPERTY_ID, $GA4_OAUTH_CLIENT_ID, $GA4_OAUTH_CLIENT_SECRET and $GA4_OAUTH_REFRESH_TOKEN.

Each environment needs its own GA4_OAUTH_REFRESH_TOKEN; a token issued while connecting from one environment can be reused in another as long as the OAuth client is the same.

Permissions

The plugin registers two permissions under Settings > Users:

Permission Description
View Analytics Access the Analytics CP page and dashboard widget
Manage Analytics Clear cache and refresh data (nested under View)

Admin users always have full access. OAuth connection and plugin settings are restricted to admins only.

Cache

API responses are cached for 5 minutes by default. You can change this in the plugin settings (Cache Duration field). Click Clear Cache & Refresh on the Analytics page to force a refresh.

Translations

The plugin ships with English and French translations. Translation files are located in src/translations/.

License

MIT

Credits

Developed by Side-Car.


All versions of craft-ga with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
craftcms/cms Version ^5.3.0
google/analytics-data Version ^0.24
google/apiclient Version ^2.15
google/apiclient-services Version ^0.450
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 sidecar/craft-ga contains the following files

Loading the files please wait ...