PHPackages                             ensue/ga4 - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. ensue/ga4

ActiveLibrary[API Development](/categories/api)

ensue/ga4
=========

Reporting API for Google analytics V4

v1.3.1(1mo ago)0439PHPPHP ^8.3

Since Aug 8Pushed 1mo agoCompare

[ Source](https://github.com/ensue-llc/Snap-Ga4)[ Packagist](https://packagist.org/packages/ensue/ga4)[ RSS](/packages/ensue-ga4/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (5)Dependencies (4)Versions (6)Used By (0)

Google analytics 4: Data API v1
===============================

[](#google-analytics-4-data-api-v1)

This package aims to provide methods for working with the Data API v1 of Google Analytics 4.

Getting Started
---------------

[](#getting-started)

### Installation

[](#installation)

You can install the package using Composer. Run the following command:

```
composer require ensue/ga4

```

### Prerequisites

[](#prerequisites)

PackageMinimum VersionLaravel13php8.3### Configuration and Language Files (Optional)

[](#configuration-and-language-files-optional)

```
php artisan vendor:publish --tag=ga4

```

### Dependencies

[](#dependencies)

Follow the step 1 and 2 provided in [Google Analytics Data API (GA4) QuickStart](https://developers.google.com/analytics/devguides/reporting/data/v1/quickstart-client-libraries). After downloading the service account credentials, store them in the **storage** directory of your Laravel project.

### Environment Changes

[](#environment-changes)

Add the following parameters to your **.env** file:

```
GA4_PROPERTY_ID=
GA4_CREDENTIALS_JSON_PATH=

```

Reporting
=========

[](#reporting)

To grant access to view the data, provide the "client email" access in your Google Analytics account's user management through your admin settings.

Provided methods
----------------

[](#provided-methods)

#### Run single report

[](#run-single-report)

```
GA::runReport($attributes);

```

#### Run Batch Report

[](#run-batch-report)

You can run up to 5 reports simultaneously.

```
GA::runBatchReport($attributes);

```

Request Body
------------

[](#request-body)

### Run single report

[](#run-single-report-1)

Maximum Dimensions allowed: 9
Maximum Metrics allowed: 10

```
$attributes = [
  "date_range" => [
    "start_date" => "Y-m-d"
    "end_date" => "Y-m-d"
  ],
  "dimensions" => [],
  "metrics" => [],
  "dimension_filter" => [FILTER_OPTIONS],
  "metric_filter" => [FILTER_OPTIONS],
  "offset" => integer,
  "limit" => integer,
  "metric_aggregations": [],
  "order_by": [],
  "currency_code": string,
  "return_property_quota": boolean
];

```

### Run Batch Report

[](#run-batch-report-1)

```
$attributes = [
    [
        "title" => string,

    ],
    [
        "title" => string,

    ],
]

```

#### Filter options

[](#filter-options)

```
    "filter" => [
        "field_name" => "{DIMENSION_NAME}"
        "expression" => "{FILTER_EXPRESSION}"
        "expression_data" => []
    ],
    "and_group" => [
        [
            "field_name" => "{DIMENSION_NAME}"
            "expression" => "{FILTER_EXPRESSION}"
            "expression_data" => []
        ]
    ],
    "or_group" => [
        [
            "field_name" => "{DIMENSION_NAME}"
            "expression" => "{FILTER_EXPRESSION}"
            "expression_data" => []
        ]
     ],
     "not_expression" => [
        "field_name" => "{DIMENSION_NAME}"
        "expression" => "{FILTER_EXPRESSION}"
        "expression_data" => []
    ],

```

#### Expression options

[](#expression-options)

##### String filter

[](#string-filter)

```
     "expression" => FilterExpression::STRING_FILTER,
     "expression_data" => [
        "match_type" => MatchType::options
        "value" => "{VALUE}",
        "case_sesitive" => boolean,
     ]

```

##### In list filter

[](#in-list-filter)

```
     "expression" => FilterExpression::IN_LIST_FILTER,
     "expression_data" => [
        "values" => [VALUES],
        "case_sensitive" => boolean,
     ]

```

##### Numeric filter

[](#numeric-filter)

```
     "expression" => FilterExpression::NUMERIC_FILTER,
     "expression_data" => [
        "operation" => Operation::options,
        "value" => [
            "int64" => integer,
            "double" => integer
        ]
     ]

```

##### Between Filter

[](#between-filter)

```
     "expression" => FilterExpression::BETWEEN_FILTER,
     "expression_data" => [
        "from" => [
            "int64" => integer,
            "double" => integer
        ],
        "to" => [
            "int64" => integer,
            "double" => integer
        ]
     ]

```

#### Order by options

[](#order-by-options)

##### Order by dimension

[](#order-by-dimension)

```
    "expression" => OrderBy::DIMENSION,
    "expression_data" => [
        "name" => Dimensions::NAME
    ]

```

##### Order by metric

[](#order-by-metric)

```
    "expression" => OrderBy::METRIC,
    "expression_data" => [
        "name" => Dimensions::NAME
    ]

```

##### Order by pivot

[](#order-by-pivot)

```
    "expression" => OrderBy::PIVOT,
    "expression_data" => [
        "name" => Dimensions::NAME,
        "pivotSelections" => [
            [
                "dimensionName" => string,
                "dimensionValue" => string
            ]
        ]
    ]

```

Contributing
------------

[](#contributing)

Feel free to contribute :)

###  Health Score

49

—

FairBetter than 94% of packages

Maintenance92

Actively maintained with recent releases

Popularity16

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~266 days

Total

5

Last Release

39d ago

PHP version history (3 changes)v1.0.0PHP ^8.1

v1.2.0PHP ^8.2

v1.3.0PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/41be2bc4f7692b281ea90b572d99e4617cb2becd68ca99931ca074c7d7d6f67f?d=identicon)[shiva\_ensue](/maintainers/shiva_ensue)

![](https://www.gravatar.com/avatar/2b9a2c6d395662236f382dc68d708cc84ac01493d438a52713266b0bf00a3790?d=identicon)[bipinensue](/maintainers/bipinensue)

![](https://www.gravatar.com/avatar/431c9c457ef18bdabff31dc290756de51120377a426b878007a8e76e1a9e1071?d=identicon)[ensueamar](/maintainers/ensueamar)

---

Top Contributors

[![bipinensue](https://avatars.githubusercontent.com/u/188851020?v=4)](https://github.com/bipinensue "bipinensue (2 commits)")[![BipinMhzn](https://avatars.githubusercontent.com/u/25446399?v=4)](https://github.com/BipinMhzn "BipinMhzn (2 commits)")[![sabin-koju](https://avatars.githubusercontent.com/u/19516598?v=4)](https://github.com/sabin-koju "sabin-koju (2 commits)")[![shivathapa41](https://avatars.githubusercontent.com/u/82861883?v=4)](https://github.com/shivathapa41 "shivathapa41 (1 commits)")

---

Tags

analyticsEnsue

### Embed Badge

![Health badge](/badges/ensue-ga4/health.svg)

```
[![Health](https://phpackages.com/badges/ensue-ga4/health.svg)](https://phpackages.com/packages/ensue-ga4)
```

###  Alternatives

[statamic/cms

The Statamic CMS Core Package

4.9k3.8M1.2k](/packages/statamic-cms)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

137236.2k8](/packages/statamic-rad-pack-runway)[duncanmcclean/statamic-cargo

Comprehensive e-commerce addon for Statamic. Build bespoke e-commerce sites without the complexity.

3622.8k](/packages/duncanmcclean-statamic-cargo)[scriptdevelop/whatsapp-manager

Paquete para manejo de WhatsApp Business API en Laravel

793.9k](/packages/scriptdevelop-whatsapp-manager)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
