Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to run realtime reports from GA4 #528

Merged
merged 1 commit into from
Dec 11, 2024
Merged

Conversation

jaroslavstefanec
Copy link
Contributor

@jaroslavstefanec jaroslavstefanec commented Dec 11, 2024

This pull request extends the functionality to enable running real-time reports from GA4.

For instance, it allows retrieving the number of active users in the last 30 minutes.

use Spatie\Analytics\Facades\Analytics;
use Spatie\Analytics\Period;

// number of active users in the last 30 minutes which is visible in GA4 -> reports -> realtime overview
$period = Period::create(Carbon::today(), Carbon::today());
Analytics::getRealtime(period: $period, metrics: ['activeUsers']);

@freekmurze freekmurze merged commit 1744fb4 into spatie:main Dec 11, 2024
11 checks passed
@freekmurze
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants