The Referral Tracking and Source Categories system in WP Statistics helps categorize and track referral traffic to your website based on a set of predefined rules and configurations. This document explains how referrals are defined, the source categories currently available, and how the plugin detects and assigns these categories.
Defining Referrals
Referrals in WP Statistics are determined by analyzing the domain information sent by browsers when a visitor is referred to your website.
- Referral Domain:
Modern browsers typically send only the domain as the referral source. WP Statistics records only the domain (e.g., example.com
) and excludes additional details such as www
, path names, or URL parameters.
- Subdomains as Domains:
Subdomains are treated as distinct referral domains. For instance, a visitor referred from sub.example.com
will be recorded separately from example.com
as a new referral domain.
Source Categories
Source Categories classify referral traffic into specific types based on the domain address and query parameters. This allows you to better understand the nature of your traffic.
- Currently Supported Categories:
- Organic Search: Traffic from non-paid search engine results.
- Paid Search: Traffic from paid search campaigns (e.g., Google Ads).
- Coming Soon:
- Organic Social: Non-paid traffic from social media platforms.
- Paid Social: Traffic from paid social media campaigns.
Each referral is assigned to one and only one source category, determined by the order of categories and rules.
Source Category Detection Rules
WP Statistics determines the source category based on the domain address and query parameters associated with the referral.
Order of Source Categories:
The order of detection is critical. WP Statistics checks each referral against the following categories in sequence:
- Direct (no referral data or from bookmarks/direct entry)
- Paid Search
- Paid Social
- Organic Social
- Organic Search
The first category that matches the referral data is assigned to the visitor.
Detection Process:
- Domain Address:
Specific domains are pre-mapped to source categories (e.g., google.com
for Paid Search).
- Query Parameters:
Query parameters further refine detection. For example, if the domain is google.com
and the URL contains query parameters matching the following pattern: /\b(gclid|gad_source)\b|utm_medium=(.*cp.*|ppc|retargeting|paid.*)(?:&|$)/
The traffic will be classified as Paid Search. You can view the complete list of domains and rules in our public configuration file: source-channels.json.
Updating Source Channel Data
If new source channels are introduced or existing rules are updated, you can manually refresh your database:
- Navigate to Optimization > Plugin Maintenance > Update Source Channel Data.
- Option Description:
“This action updates and corrects any unidentified source channels in the database. Please be patient, as this process might take some time depending on the amount of data.”
Note: Accuracy may vary, as only whitelisted query parameters are retained.
Privacy Considerations
For privacy compliance, WP Statistics removes all query parameters from URLs before saving them in the database. However:
- Only whitelisted query parameters are retained. You can manage these parameters under Settings > Filtering & Exceptions > URL Query Parameters (learn more).
- Source category detection occurs before query parameters are cleaned, ensuring accurate categorization.
Examples
- If a visitor is referred from
google.com
with the query parameter gclid
, the traffic will be categorized as Paid Search.
- A referral from
bing.com
without paid campaign parameters will fall under Organic Search.
Feedback and Customization
- If you encounter an issue with incorrect source categorization or want to add a specific URL to a source category, let us know via GitHub or our Contact Page.
Version History
- Referral tracking with source categories was introduced in version 14.11.