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

The ModuleAnalytics module for Wowza Streaming Engine media server software can be used to 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, to see who is watching RTMP versus HLS streams) and how long the viewer watches the content.

Contents


Prerequisites
Installation
Configuration
Properties
Usage
For developers

Prerequisites


Wowza Streaming Engine™ 4.0.0 or later is required.

You'll need your Google tracking ID for the domain (website property) being tracked in Google Analytics. See Find your tracking code, tracking ID, and property number. The tracking ID is a string like UA-000000-01.

Installation


  1. Download wse-plugin-analytics.zip.
     
  2. Extract the contents from the downloaded (zipped) package, and then copy the lib/wse-plugin-analytics.jar file from the package to the lib folder in your Wowza Streaming Engine installation ([install-dir]/lib).
     
  3. Restart Wowza Streaming Engine.

Configuration


To enable this module, add the following module definition to your application configuration. See Configure modules for details.
 
Name
Description
Fully Qualified Class Name
ModuleAnalytics Sends statistics to Google Analytics. com.wowza.wms.plugin.Analytics

Properties


After enabling the module, you can adjust the default settings by setting the following properties at the server level or the application level. Application-level properties will override the same property name set at the server level. See Configure properties for details.
 
Path
Name
Type
Value
Notes
/Root/Server or /Root/Application wowzalyticsGACode String UA-000000-01 Tracking ID for the domain (website property) being tracked in Google Analytics. (default: not set)
/Root/Server or /Root/Application wowzalyticsGADomain String myCompany.com Domain name (website property) being tracked. (default: not set)
/Root/Server or /Root/Application wowzalyticsGAHost String hostName.myCompany.com Host name being tracked. (default: not set)
/Root/Server or /Root/Application wowzalyticsGAPrefix String myPrefix Optional prefix to use. (default: not set)
/Root/Server or /Root/Application wowzalyticsStatsNotificationUrls String http://stats.example.com/stats.php Optional comma-separated list of URLs to send the statistics to. If used, these URLs must be able to accept the requests. (default: not set)
/Root/Server or /Root/Application wowzalyticsDebug Boolean false Enables extra debug logging. (default: false)

The following properties can only be set at the server level. They control the threads that send the data to the Google Analytics service. See Configure properties for details.
 
Path
Name
Type
Value
Notes
/Root/Server wowzalyticsThreadPoolSize Integer 5 Number of threads used to send data. (default: 5)
/Root/Server wowzalyticsDelayForFailedRequests Integer 1000 Time, in milliseconds, to wait between failed requests. (default: 1000)
/Root/Server wowzalyticsHTTPMaxRetries Integer 5 Number of times to retry a failed request before giving up. (default: 5)
/Root/Server wowzalyticsThreadPoolTerminationTimeout Integer 5 When shutting down, time, in seconds, to wait to allow all requests to be sent. (default: 5)

Usage


Google Analytics reports the connections in real-time and historically. To see the real-time connections in Google Analytics, navigate to your view, and then click Real-Time > Content in the left panel. You will see connections formatted as protocol[event]-streamName. For example: RTMPConnect-myStream.

To see historical statistics, navigate to your view, and then click Behavior > Site Content > All Pages in the left panel. You'll see similar information for the date range you've selected. This reference includes the application instance in the statistics.

For developers