Configure Google Analytics o su propio seguimiento analítico personalizado, como se describe en las siguientes secciones.
Configurar Google Analytics
Antes de configurar Google Analytics, necesitará una cuenta de Google Analytics y acceso al código de seguimiento que se añadirá a las páginas de su portal y que se usará para monitorizar la actividad en su sitio. Para obtener más información, consulte la
ayuda de Google Analytics.
Para configurar Google Analytics, siga estos pasos:
Interfaz de usuario de Cloud Console
En la consola de Apigee en Cloud, ve a la página Distribución > Portales.
En el menú de navegación, haz clic en Configuración.
Haga clic en la pestaña Scripts personalizados.
En Google Analytics, introduzca su ID de seguimiento de Google Analytics.
Haz clic en Guardar.
Interfaz clásica
Seleccione Publicar > Portales y elija el portal.
Selecciona Configuración en el menú desplegable de la barra de navegación superior.
También puedes hacer clic en Configuración en la página de destino del portal.
Haga clic en la pestaña Scripts personalizados.
En Google Analytics, introduzca su ID de seguimiento de Google Analytics.
Haz clic en Guardar.
Configurar el seguimiento de analíticas personalizado
Configure su propia solución de seguimiento de analíticas personalizada transfiriendo los detalles de los eventos a su propia función personalizada. Tu función personalizada debe definirse como parte de portal.onAnalyticsEvent en el espacio de nombres global (declarado en la variable window).
Por ejemplo, puede que quiera enviar los detalles del evento a un servicio de analíticas que no sea Google Analytics:
<script>
window.portal = {};
window.portal.onAnalyticsEvent = (event) => {
// log event to console
console.log(event);
// TODO: publish event to custom analytics service
}
</script>
Añada su secuencia de comandos personalizada a cada página de su portal en la pestaña Secuencias de comandos personalizadas de la página Configuración. Para obtener más información, consulte el artículo Añadir secuencias de comandos personalizadas.
El portal genera los siguientes tipos de eventos con el mismo formato que usa Google Analytics:
[[["Es fácil de entender","easyToUnderstand","thumb-up"],["Me ofreció una solución al problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Es difícil de entender","hardToUnderstand","thumb-down"],["La información o el código de muestra no son correctos","incorrectInformationOrSampleCode","thumb-down"],["Me faltan las muestras o la información que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-09-11 (UTC)."],[[["\u003cp\u003eThis documentation applies to both Apigee and Apigee hybrid platforms.\u003c/p\u003e\n"],["\u003cp\u003eYou can configure Google Analytics by entering your tracking ID in the portal settings under the "Custom Scripts" tab.\u003c/p\u003e\n"],["\u003cp\u003eCustom analytics tracking can be configured by defining a function \u003ccode\u003eportal.onAnalyticsEvent\u003c/code\u003e in the global namespace to handle event data.\u003c/p\u003e\n"],["\u003cp\u003eThe portal generates events such as page visits and clicks on "Execute" in the API reference documentation, which can be tracked.\u003c/p\u003e\n"]]],[],null,["# Configuring analytics tracking\n\n*This page\napplies to **Apigee** and **Apigee hybrid**.*\n\n\n*View [Apigee Edge](https://docs.apigee.com/api-platform/get-started/what-apigee-edge) documentation.*\n\n\u003cbr /\u003e\n\nConfigure Google analytics or your own custom analytics tracking, as described\nin the following sections.\n\nConfiguring Google Analytics\n----------------------------\n\nBefore you can configure Google Analytics, you'll need a Google Analytics\naccount and access to the tracking code that will be added to your portal\npages and used to track activity on your site. For more information, see\n[Google Analytics help](https://support.google.com/analytics).\n\nTo configure Google Analytics: \n\n### Cloud Console UI\n\n1. In the Apigee in Cloud console, go to the **Distribution \\\u003e Portals** page.\n\n [Go to Portals](https://console.cloud.google.com/apigee/portals)\n2. Click your portal.\n\n3. Click **Settings** in the navigation menu.\n\n4. Click the **Custom Scripts** tab.\n\n5. Under **Google Analytics**, enter your Google Analytics tracking ID.\n\n6. Click **Save**.\n\n### Classic UI\n\n1. Select **Publish \\\u003e Portals** and select your portal.\n2. Select **Settings** in the drop-down menu in the top navigation bar. Alternatively, you can click **Settings** on the portal landing page.\n3. Click the **Custom Scripts** tab.\n4. Under **Google Analytics**, enter your Google Analytics tracking ID.\n5. Click **Save**.\n\nConfiguring custom analytics tracking\n-------------------------------------\n\nConfigure 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).\n\nFor example, you might want to send the event details to an analytics service other than Google Analytics: \n\n \u003cscript\u003e\n window.portal = {};\n window.portal.onAnalyticsEvent = (event) =\u003e {\n // log event to console\n console.log(event);\n // TODO: publish event to custom analytics service\n }\n \u003c/script\u003e\n\nAdd your custom script to each page in your portal on the **Custom Scripts** tab of the Settings page. For more information, see [Adding custom scripts](/apigee/docs/api-platform/publish/portal/custom-scripts).\n\nThe portal generates the following types of events in the same format used by Google Analytics:"]]