Google Analytics recommended and custom events

Use the Data Manager API to send Google Analytics recommended and custom events.

Check out Send events for details.

If you're upgrading from the Google Analytics Measurement Protocol check out Upgrade from Measurement Protocol to the Data Manager API for instructions.

Use cases

Here are some use cases for sending recommended and custom events with the Data Manager API:

  • Tie online to offline behavior.

  • Measure client-side and server-side interactions.

  • Send events that happen outside standard user interaction, like offline conversions.

  • Send events from devices and apps where automatic collection isn't available, like kiosks and watches.

User-provided data

You can send first-party customer data, such as hashed email addresses, phone numbers, and physical addresses, in the userData field of an Event. This helps improve conversion measurement, attribution, and audience building in Google Analytics.

Keep the following in mind when sending user-provided data:

  • Sent with events: In the Data Manager API, user-provided data must be sent as part of an Event. Standalone uploads without an event aren't supported.

  • Formatting and hashing: Personal identifiers (such as email address, phone number, name, and street address) must be normalized and hashed using SHA-256 before upload. Other fields (such as city, state or province, postal code, and country code) are normalized but not hashed. Follow the Format user data guide for specific requirements.

  • Encryption: You can optionally encrypt hashed user data.

  • User-ID: We recommend providing the userId alongside userData whenever a consistent user identifier is available.

  • Implementation: See Add user-provided data for instructions on constructing requests.

Integration considerations

Keep the following considerations in mind when using the Data Manager API.

Remarketing

Google Analytics supports same-device remarketing when you turn on Google signals. For cross-device remarketing, userId is required.

In addition, you can send user-provided data to enable first-party audience matching.

Advertising identifiers

Google Analytics automatically joins advertising identifiers (such as GBRAID or WBRAID) collected during online interactions with Data Manager API events using clientId or appInstanceId.

Privacy settings

Google Analytics joins Data Manager API events with online interactions using clientId or appInstanceId to adopt user privacy settings such as "non-personalized ads" and "limit ad tracking".

You can also specify user consent settings directly on each event using the consent object.

Geographic and device information

Google Analytics automatically joins the most recent geographic and device information from tagging with Data Manager API events using clientId or appInstanceId. This ensures that your Data Manager API events are reflected in reports that include geographic and device dimensions.

If you want a Data Manager API event to reflect geographic and device information from a specific session instead of the latest information for the clientId or appInstanceId, include an entry in additionalEventParameters with parameterName set to session_id and value set to the ID of the specific session, and send the event within 24 hours of the start of the session.

You can provide geographic information and device information for events using the Data Manager API.

Full server-to-server

While it's possible to send events to Google Analytics solely with the Data Manager API, only partial reporting might be available. The purpose of the Data Manager API is to augment existing events collected using gtag, Tag Manager, or Firebase. Some event and parameter names are reserved for use through automatic collection and can't be sent through the Data Manager API.

Generate or rename events

Events sent with the Data Manager API don't trigger rules for generating or renaming events. Your application should implement the logic to send custom events through the Data Manager API, similar to the rules configured in the Google Analytics UI.