Polylang is a popular multilingual WordPress plugin that allows you to create content in multiple languages with language-specific URLs, posts, pages, and taxonomies. When running a multilingual website, accurate view counting requires proper integration to ensure views are attributed to the correct language version of each piece of content.
Post Views Counter includes a dedicated Polylang integration that handles language-aware tracking and reporting. This integration ensures that view counts remain accurate across all language versions of your content, whether you’re tracking posts, pages, taxonomies, or other content types.
How It Works
Post Views Counter automatically detects Polylang and activates its compatibility layer through a dedicated integration file. This integration operates transparently—no manual activation is required once both plugins are installed and active.
The integration works by:
- Language-aware query modification: Adjusts internal queries to respect Polylang’s language filtering when retrieving view statistics
- Admin bar integration: Ensures the admin toolbar displays correct language context when viewing content
- Dashboard compatibility: Modifies dashboard queries to show views for the appropriate language versions
For Pro users, the integration extends to:
- Reports integration: Ensures the Reports feature displays accurate view counts per language version
- Term views handling: Properly attributes taxonomy term views to the correct language
- Settings script compatibility: Maintains language context in the settings interface
Setup
Prerequisites
- Install and activate Polylang (free or Pro version)
- Install and activate Post Views Counter (Lite or Pro)
- Configure your languages in Polylang before enabling view tracking
Configuration Steps
-
Configure Polylang first: Set up all your languages in Polylang at Languages → Languages. Create translations for your posts, pages, and taxonomies.
-
Enable tracking for your content types: Navigate to Post Views > Counting > Tracking Targets and select which post types should have views counted. Ensure these match the post types you’ve translated in Polylang.
-
Verify display settings: Go to Post Views > Display > Display Targets and confirm the post types where views should appear. This applies to all language versions of those post types.
- Taxonomy tracking: If you track taxonomy views (enabled at Post Views > Counting > Tracking Targets), the integration automatically handles language-specific term views in your reports.
Configuration
Post Views Counter Settings
The following PVC settings are relevant when using Polylang:
| Setting | Location | Consideration |
|---|---|---|
| Post Types to Count | Post Views > Counting > Tracking Targets | Select all post types you translate with Polylang |
| Post Types Display | Post Views > Display > Display Targets | Views will display on all language versions of selected post types |
| Counter Mode | Post Views > Counting > Tracking Behavior | All counter modes (PHP Mode, JavaScript Mode, REST API Mode, Fast AJAX) are compatible with Polylang |
Polylang Settings
No specific Polylang settings need modification for Post Views Counter compatibility. The integration works with Polylang’s default configuration. However, consider:
- Language negotiation method: All Polylang URL modes (directory path, subdomain, or domain per language) are supported
- Synchronized content: If you synchronize certain content between languages, views are counted separately for each language version
Troubleshooting
Views Not Displaying on Translated Content
Symptoms: View counts appear on the default language version but not on translated versions.
Solutions:
- Verify the translated content is published and publicly accessible
- Check that the post type is enabled at Post Views > Display > Display Targets
- Ensure the page type is enabled at Post Views > Display > Display Targets (singular pages must be selected)
- Clear any caching plugins that may be serving cached versions of translated pages
Counts Appear Combined Across Languages
Symptoms: View counts seem identical across different language versions of the same content.
Solutions:
- This is expected behavior if you’re using PHP Mode with certain caching configurations
- For accurate per-language counting with page caching, consider using JavaScript Mode or REST API Mode at Post Views > Counting > Tracking Behavior
- Verify Polylang is properly configured with distinct URLs for each language
Admin Dashboard Shows Wrong Language Content
Symptoms: The Post Views Counter dashboard widget or statistics show content from only one language.
Solutions:
- The integration respects Polylang’s admin language filter—check if you have a language filter active in the admin bar
- Clear your browser cache and reload the admin dashboard
- Verify both plugins are running their latest versions
Reports Not Filtering by Language
Symptoms: The Reports feature shows combined statistics instead of language-specific data.
Solutions:
- Ensure you’re using the latest version of both plugins
- Check that the Polylang integration is active
- Navigate to Post Views > Other > Plugin Status to verify the integration status
Views Reset After Language Configuration Changes
Symptoms: View counts reset or disappear after modifying Polylang language settings.
Solutions:
- Changing Polylang’s URL structure or language settings does not affect stored view counts
- If views appear missing, check that content IDs haven’t changed (this can happen with some import/export operations)
- Use the import feature at Post Views > Other > Data Import if you need to restore view data
