How to useDownloads Statistics for WordPress

The plugin allows track files downloads in specific site’s relative path by sending statistics to Google Analytics and the Local Database.

Settings#

settings

General#

  • Relative site path
    • Enable

      It is useful to disable item without deleting the configuration.

    • Use event label

      Use statistics event label for that path. Doesn’t work if common statistics event label is disabled.

    • Path

      Type relative site’s path to monitor it’s files downloads.

      Note: Choose path more precisely. Otherwise, it might degrade performance of downloading site’s elements.

    • Files types

      List of comma separated files extensions that only be included in monitor.

      Note: There are system file types that always excluded from monitoring to prevent unstable site work: *.htaccess, *.php, *.js and *.css.

  • Statistics event label

    It is possible to use URL’s arguments as a statistics label. Label will be formed from a list of request’s arguments using the argument separator and the value delimiter.

    • Enable

      Check to use it in all paths. Each path can enable it separately.

    • Argument separator

      Separator between arguments.

    • Argument value delimiter

      Separator between argument’s name and value.

    So e.g. for URL ‘http://yoursite.com/page?arg1=v1&arg2=v1’ in case of ‘Argument separator’ = ‘,’ and ‘Argument value delimiter’ = ‘:’ label will be ‘arg1:v1,arg2:v2’.

  • Send mode

    By default statistic sending each minute to provide data on the time.

    Note: There is the alternative way how to setup WP Cron on your site.

Google Analytics#

If enabled, statistics will be sent to Google Analytics account by specified tracking ID as events with specified event category, URI as event action and URL arguments as event label if it is enabled in general settings.

  • Enable

    Set this checkbox to enable statistics sending.

  • Tracking ID

    Tracking ID of the account. Type your Google Analytics’s tracking ID.

  • Event category

    Event category that will be seen in the events’ dashboard. Change event category if needed.

  • Custom dimension for client ID

    Custom dimension index to store client ID for debug purposes e.g. user’s IP. Optional.

Local Database#

If enabled, statistics will be written to the local database table with name ‘wp_seraph_dlstat’. Use any databese viewer or editor to see events. It is used generally for debug purposes only or if there is no any other way.

  • Enable

    Set this checkbox to enable statistics writing.

  • Data

    Set this checkbox and all data will be erased. If ‘Enabled’ is unchecked ‘wp_seraph_dlstat’ table will be deleted as well.

Configuration under NGINX#

To enable working under NGINX the following directives should be added manually into the begin of server directive:

# seraphinite-downloads-stats - File hook redirection
include /www/wwwroot/my-site.com/seraph-dlstat.conf;

And the /www/wwwroot/my-site.com should be replaced by your site’s root filesystem path.

Note. After changing the settings, you need to manually update the NGINX configuration.

API#

There are a set of filters and actions to hook.

seraph_dlstat_prepare_events filter

seraph_dlstat_event_label_format filter

seraph_dlstat_items_download_requested action

seraph_dlstat_ga_prepare_event filter

Requirements#

  • WordPress 4.5 or higher.
  • PHP 5.4 or higher.
  • Apache Web Server 2.0 or higher (for site’s .htaccess file).
  • Browser (Google Chrome, Firefox, IE).

Leave a Reply