window.bx_analytics && bx_analytics.track('signup_click', {plan: 'pro'});
import { trackEvent } from 'app/lib/analytics';
trackEvent('signup_click', { plan: 'pro' });
bx_srv('bx_analytics', 'track', ['export_done', ['rows' => 120]]);
curl -X POST 'https://example.com/api.php?r=bx_analytics/collect' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"platform": "api", "app": "my-client", "app_version": "1.0.0", "hits": [{"type": "pageview", "url": "https://example.com/pricing", "title": "Pricing"}, {"type": "event", "name": "signup_click", "url": "https://example.com/pricing", "props": {"plan": "pro"}}]}'
api.php?r=bx_analytics/get_tracker_config¶ms[]=next-web
bx_srv('bx_analytics', 'get_report', ['overview', ['range' => '30d', 'platform' => 'rn-ios']]);
api.php?r=bx_analytics/get_report¶ms[]=top¶ms[]={"group":"pages","tab":"entry","range":"7d"}
public function serviceGetAnalyticsRevenue($aParams = [])
{
$aResult = ['title' => '_bx_mymodule', 'unit' => 'money'];
if(!is_array($aParams) || !empty($aParams['meta']))
return $aResult;
// count what happened between $aParams['from'] and $aParams['to'] (unix times, `to` exclusive)
$aResult['metrics'] = [
'issued' => ['title' => '_bx_mymodule_txt_analytics_issued', 'value' => 12, 'money' => 480.0],
];
return $aResult;
}
docker compose exec -w /opt/una php ./plugins/bin/phpunit -c tests/phpunit.xml --filter 'Analytics|BxAnalytics'