Configuring analytics tracking

This page applies to Apigeeand Apigee hybrid.

View Apigee Edge documentation.

Configure Google analytics or your own custom analytics tracking, as described in the following sections.

Configuring Google Analytics

Before you can configure Google Analytics, you'll need a Google Analytics account and access to the tracking code that will be added to your portal pages and used to track activity on your site. For more information, see Google Analytics help .

To configure Google Analytics:

Cloud Console UI

  1. In the Apigee in Cloud console, go to the Distribution > Portalspage.

    Go to Portals

  2. Click your portal.

  3. Click Settingsin the navigation menu.

  4. Click the Custom Scriptstab.

  5. Under Google Analytics, enter your Google Analytics tracking ID.

  6. Click Save.

Classic UI

  1. Select Publish > Portalsand select your portal.
  2. Select Settingsin the drop-down menu in the top navigation bar. Alternatively, you can click Settingson the portal landing page.
  3. Click the Custom Scriptstab.
  4. Under Google Analytics, enter your Google Analytics tracking ID.
  5. Click Save.

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 the portal.onAnalyticsEvent  in the global namespace (declared on the window 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 the Custom Scriptstab of the Settings page. For more information, see Adding 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
 {
  hitType: 'pageview',
  page: '/apis'
}; 
Page Views
Clicks on Execute on the Try it panel in the API reference doc
 {
  hitType: 'event',
  eventCategory: 'docsEvents',
  eventAction: 'apixExecute'
} 
Event Measurement
Create a Mobile Website
View Site in Mobile | Classic
Share by: