Configuring analytics tracking Stay organized with collections Save and categorize content based on your preferences.
This pageapplies toApigee andApigee hybrid.
View Apigee Edge documentation.![]()
Configure Google analytics or your own custom analytics tracking, as describedin the following sections.
Configuring Google Analytics
Before you can configure Google Analytics, you'll need a Google Analyticsaccount and access to the tracking code that will be added to your portalpages and used to track activity on your site. For more information, seeGoogle Analytics help.
To configure Google Analytics:
In the Apigee in Cloud console, go to theDistribution > Portals page.
Click your portal.
ClickSettings in the navigation menu.
Click theCustom Scripts tab.
UnderGoogle Analytics, enter your Google Analytics tracking ID.
ClickSave.
Configuring custom analytics tracking
Configure your own custom analytics tracking solution by passing event details to your own custom function. Your custom function must be defined as part of theportal.onAnalyticsEvent in the global namespace (declared on thewindow variable).
For example, you might want to send the event details to an analytics service other than Google Analytics:
<script>window.portal = {};window.portal.onAnalyticsEvent = (event) => { // log event to console console.log(event); // TODO: publish event to custom analytics service}</script>Add your custom script to each page in your portal on theCustom Scripts tab of the Settings page. For more information, seeAdding custom scripts.
The portal generates the following types of events in the same format used by Google Analytics:
| Event type | Example format | More information |
|---|---|---|
| Page visits | | Page Views |
| Clicks onExecute on the Try it panel in the API reference doc | | Event Measurement |
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-17 UTC.