More Products

How to add analytics to your integration

Last updated: Oct-30-2024

Integrating analytics into your code is essential for your Cloudinary integration and is a requirement for becoming a Cloudinary partner. By incorporating analytics, Cloudinary gains valuable insights that refine and enhance the features we offer to partners and customers.

Furthermore, analytics play a crucial role in resolving support issues. They help our support team determine whether the issue lies within your integration or the customer's code. If the problem is related to your integration, our support teams can promptly notify you, as it may impact other customers using the integration.

Moreover, integrating analytics now lays the groundwork for incorporating more detailed insights that Cloudinary plans to provide in the future. Your collaboration sets the stage for future enhancements and mutual growth, fostering a strong partnership.

Customizing the user agent for SDK-based integrations

Customize your existing RFC compliant user agent string by prefixing it with your integration's name and version, along with the name and version of the platform you're integrating with Cloudinary. This modification provides additional context for analytics and tracking in requests to Cloudinary.

Here's how to add and format the prefix to your user agent:

For example:

The resulting user agent might look like this:

Note
Make sure to update your user agent after performing upgrades.

Including user-agent headers in REST API calls

When making direct REST API calls to Cloudinary without using a Cloudinary SDK, include a user-agent header. This allows Cloudinary to identify essential details such as the name and version of your integration, as well as the name and version of the platform you're integrating with Cloudinary:

For example:

Media Library widget integration configuration

When configuring the Media Library widget, make sure to include an object named integration as part of the widget’s configuration options. This parameter enables seamless analytics tracking within the widget for analyzing usage patterns and performance metrics.

integration includes the following attributes:

  • type: The name of your integration.
  • platform: The name of platform that you're integrating with Cloudinary.
  • version: The version of your integration.
  • environment: The deployment environment, such as "prod" for production, "stag" for staging, or "dev" for development.

The following sample code snippet demonstrates the structure of the integration parameter within your JavaScript setup code:

✔️ Feedback sent!

Rate this page: