1. Go to this page and download the library: Download vipertecpro/app-analytics library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
vipertecpro / app-analytics example snippets
use Vipertecpro\AppAnalytics\Facades\Analytics;
use Vipertecpro\AppAnalytics\Facades\RemoteConfig;
Analytics::logScreenView('Checkout');
Analytics::logEvent('purchase_started', ['plan' => 'pro', 'price' => 9.99, 'trial' => true]);
Analytics::setUserProperty('plan', 'pro');
Analytics::setUserId($user->id); // never an email or phone number
if (RemoteConfig::bool('new_checkout')) {
// the new flow
}
$title = RemoteConfig::string('welcome_title');
$limit = RemoteConfig::int('max_items', 20);
use Native\Mobile\Attributes\On;
use Vipertecpro\AppAnalytics\Events\RemoteConfigFetched;
use Vipertecpro\AppAnalytics\Events\RemoteConfigFetchFailed;
public function mount(): void
{
RemoteConfig::fetchAndActivate(); // asynchronous
}
#[On(RemoteConfigFetched::class)]
public function onFlags(bool $activated): void
{
// RemoteConfig already reads the new values; re-render whatever depends on them
}
#[On(RemoteConfigFetchFailed::class)]
public function onFlagsFailed(string $reason): void
{
// not_configured | throttled | network | error — the old values and defaults keep working
}