Send connection and stream statistics to Google Analytics with a Wowza Streaming Engine Java module

The ModuleAnalytics Java module for Wowza Streaming Engine media server software can automatically send data to Google Analytics. You can configure each application to send data to the same Google account or to separate accounts.

When viewed in Google Analytics, this data provides information about your applications and application instances so you can better understand how your content is used. Gathered statistics include the number of connections per stream and per protocol. For example, you can compare viewership for RTMP and HLS streams or see how long viewers watch certain content.

Prerequisites


Before you start, make sure you meet the following installation and setup requirements:

  • Install Wowza Streaming Engine™ 4.8.22 or later.
  • If upgrading from an earlier version of Wowza Streaming Engine, install Java 11 with the java.net.http module included.
  • Generate a Google Measurement ID for the domain or website property being tracked in Google Analytics. This Measurement ID is a string like G-XXXXXXXXXX. For more, see the next section or check Find your Google tag ID.

Set up Google Analytics


Before working with this custom Java module, ensure you've completed these steps to get started in Google Analytics. You can use this setup guide from Google for more help.

  1. Create a Google Analytics account.
  2. In your Google Analytics account, create a new Google Analytics 4 property.
  3. Add a Web data stream for the GA4 property you created. When you add the data stream, ensure Video engagement is enabled in the Enhanced measurement section.
  4. From the Web stream details page, click to Modify events and create a new modification. For Matching conditions, set the event_name parameter to the starts with operator and the video value.

In the Modify parameters section, add the video_protocol, video_type, video_rendition, and video_live_progress parameters. This setup adds these four parameters to the existing GA4 video events.

  1. From the Web stream details page, click to Create custom events. Add two custom events named video_publish and video_unpublish. Each custom event should also have these parameters:
  • video_title
  • video_url
  • video_provider
  • video_type
  • video_protocol
  • video_current_time

  1. From the web stream details, copy the Measurement ID so you can use it in the Wowza module properties.

Install the module


  1. Download wse-plugin-analytics-2.0.2.jar to the lib folder in your Wowza Streaming Engine installation ([install-dir]/lib) directory.
  2. Restart Wowza Streaming Engine.

Configure the module


Add the following definition to your application configuration to enable this module. See Configure modules for details.

 
Name
Description
Fully Qualified Class Name
ModuleAnalytics Sends statistics to Google Analytics. com.wowza.wms.plugin.analytics.ModuleGA4

Configure module properties


After enabling the module, you can adjust the default settings by changing the following properties at the application or server level. See Configure properties for details.

Required properties

Path
Name
Type
Value
Description
/Root/Application
or /Root/Server
ga4MeasurementId String G-XXXXXXXXXX Measurement ID for the data stream in the Google Analytics property.

Optional properties

Path
Name
Type
Default value
Description
/Root/Application
or /Root/Server
ga4VideoProvider String Wowza Streaming Engine Name of the server that is sending events.
/Root/Application
or /Root/Server
ga4GoogleUrlDomain String www.google-analytics.com Change to container URL for sending events via a server-side Google Tag Manager container.
/Root/Application
or /Root/Server
ga4VodPercentages String 10, 25, 50, 75 Comma-separated list of percentage values to send video_progress events.
/Root/Application
or /Root/Server
ga4LiveUpdateFrequency Integer 300 Number of seconds between live update video_progress events.
/Root/Application
or /Root/Server
ga4SendPublishEvents Boolean false Enable to send publish events for live streams. Doesn't send events for server-generated streams.
/Root/Application
or /Root/Server
ga4DebugEnabled Boolean false Enable debug logging in the module and append the _dbg=1 parameter to requests.
/Root/Application
or /Root/Server
ga4TagMangerPreviewString String EXAMPLE-Y1dDMFNPbS04aC1Mb... Set to enable debugging when sending data via a server-side Google Tag Manager container.
/Root/Application
or /Root/Server
ga4DebugIpOverride String 1.2.3.4 Set a public IP for testing from behind a NAT router.

Usage notes


Realtime reporting

Google Analytics reports connections in real-time and historically. See Realtime report. All Google reports, except for the Realtime report, include a filter to adjust the date range for a lookback period. For more, see Understanding Google Analytics reports.

Event tracking

When you specify your Google Measurement ID, Wowza Streaming Engine reports all video_start, video_progress, and video_complete events using the existing GA4 video events. The two custom events we added optionally track video_publish and video_unpublish events.

Note: For automatically collected events, only the title, url, and provider parameters are available in the default reports.

For full reporting, add custom events and parameters to your GA4 property and create custom dimensions for each parameter. Go to the Admin menu for you Google Analytics property. Click Custom definitions Create custom dimensions. Custom dimensions take at least 24 hours to populate with data once created.

In addition to the default parameters, you can track data for the modified parameters we added, such as video_type (live stream or video-on-demand stream), video_rendition, video_protocol, and video_live_progress.

The module can send event data via a server-side Tag Manager instance for further processing before forwarding it to GA4. For more, see An introduction to server-side tagging.

For developers