ShahiLandin includes built-in analytics to track landing page performance without requiring external tools. Monitor views, conversions, click patterns, and engagement metrics to optimize your campaigns.
Analytics Features
The analytics system provides:
- Page View Tracking: Automatic visitor counting with bot filtering
- Conversion Tracking: Monitor form submissions and goal completions
- Click Tracking: Record interactions with buttons and links
- Conversion Rate Calculation: Automatic calculation of conversion percentages
- Historical Data: View trends over time
- Individual Page Analytics: Detailed metrics for each landing page
- Navigate to Settings > ShahiLandin
- Find the Analytics section
- Toggle Analytics Enabled to ON
- Configure tracking options:
- Click Save Changes
- Edit a landing page
- Find the ShahiLandin Analytics meta box in the sidebar
- Toggle tracking options for this specific page
- Update the page
- A view is recorded each time a visitor loads your landing page
- The plugin uses server-side tracking for reliability
- Googlebot, Bingbot, Yahoo Slurp
- Generic crawlers and spiders
- Search engine indexers
- Uses transient cookies to prevent counting the same visitor multiple times
- One view per visitor per hour (configurable)
- Based on IP address and user agent combination
- All
links (external and internal) elements- Form submission buttons
- CTA (call-to-action) elements
- Requires
analytics.jsto be loaded - Tracks click coordinates and target element
- Records timestamp and visitor information
- Clicks are sent to
/wp-json/shahilandin/v1/analytics/track-click - Asynchronous to avoid slowing down page interactions
- Form submissions on the landing page
- Custom goal completions (defined via code)
- Button clicks with
data-shahilandin-conversionattribute - Go to Landing Pages > All Landing Pages
- Enable the Views and Conversions columns via Screen Options
- See at-a-glance metrics for all pages
- Edit the landing page
- Find the ShahiLandin Analytics meta box
- View current statistics:
- Go to the main WordPress Dashboard
- Click Screen Options at the top
- Enable ShahiLandin Analytics
- The widget shows top-performing landing pages by views and conversions
- Views:
shahilandinviews(integer count) - Conversions:
shahilandinconversions(integer count) - Views Log:
shahilandinviews_log(timestamped array) - Conversions Log:
shahilandinconversions_log(timestamped array) - 500 views + 25 conversions = 5% conversion rate
- Go to Landing Pages > Analytics Export
- Select date range
- Choose pages to include
- Click Download CSV
- Page title and URL
- Total views and conversions
- Conversion rate
- Daily breakdown
- Go to Settings > ShahiLandin > Analytics
- Enter your GA4 Measurement ID
- Enter your GA4 API Secret
- Save settings
- Sends events to GA4 for centralized reporting
- Custom event names:
shahilandinview,shahilandinconversion - User properties include landing page ID and title
- Go to Settings > ShahiLandin > Analytics
- Enter your Mixpanel Token
- Save settings
Landing Page ViewedLanding Page Converted- Custom properties for segmentation
- Edit a landing page
- Find the ShahiLandin Head Assets meta box
- Add Facebook Pixel code to Scripts:
- IP addresses (for duplicate detection)
- User agent strings (for bot filtering)
- Referrer URLs
- Timestamps
- Go to Settings > ShahiLandin > Analytics
- Set Data Retention Period (30, 60, 90 days, or Forever)
- Old data is automatically purged via cron job
- Cookie Notice for GDPR
- Complianz GDPR/CCPA
- GDPR Cookie Consent
- Other standard consent plugins
- Uses AJAX for view and click tracking
- Works with WP Rocket, W3 Total Cache, and other caching plugins
- No impact on cached page performance
- Prune Old Data: Set a retention period to limit database growth
- Archive Historical Data: Export and delete old analytics periodically
- Index Meta Keys: ShahiLandin automatically creates database indexes for fast queries
- Go to Settings > ShahiLandin
- Verify Analytics Enabled is ON
- Clear your site cache
- Try viewing in an incognito window
- Analytics filters bots by default
- Test with a standard browser, not developer tools
- Ensure buttons have
data-shahilandin-conversionattribute - Check that
analytics.jsis loaded on the page - Open browser DevTools console
- Look for errors related to ShahiLandin
- Transient caching prevents duplicates for 1 hour
- If testing repeatedly, clear cookies between tests
- Verify bot filtering is working
- Check user agent logs for suspicious patterns
- Track View:
POST /wp-json/shahilandin/v1/analytics/track-view - Track Click:
POST /wp-json/shahilandin/v1/analytics/track-click - Track Conversion:
POST /wp-json/shahilandin/v1/analytics/track-conversion - Get Analytics:
GET /wp-json/shahilandin/v1/analytics/{post_id} - Set Clear Goals: Define what counts as a conversion before launching
- Test Tracking: Always test analytics in staging before going live
- Review Regularly: Check analytics weekly to spot trends
- Compare Periods: Use date range filters to compare performance
- Export Data: Regularly back up analytics to CSV for reporting
- Combine with External Tools: Use ShahiLandin + GA4 for comprehensive insights
Enabling Analytics
Global Settings
– Track Views: Count page visitors
– Track Clicks: Record button and link clicks
Default State: Analytics is enabled by default.
Per-Page Settings
Analytics can be enabled or disabled for individual landing pages:
How Analytics Works
View Tracking
Automatic Tracking:
Bot Filtering:
The system automatically filters common bots and crawlers:
Duplicate Prevention:
Click Tracking
What Gets Tracked:
JavaScript-Based:
REST API Endpoint:
Conversion Tracking
What Counts as a Conversion:
Manual Conversion Tracking:
Add this attribute to any element to track it as a conversion:
`html
`
Programmatic Tracking (for developers):
`javascript
// Track a conversion via JavaScript
ShahiLandinAnalytics.trackConversion(‘newsletter_signup’, {
email: ‘user@example.com’,
source: ‘hero_cta’
});
`
Viewing Analytics Data
Landing Page List
The landing pages admin list displays quick metrics:
Individual Page Analytics
View detailed analytics for a specific landing page:
– Total Views: Lifetime visitor count
– Total Conversions: Goal completions
– Conversion Rate: Percentage of visitors who convert
– Last 30 Days: Recent performance trends
Analytics Dashboard Widget
Add a dashboard widget for quick access:
Analytics Data Structure
Data Storage
Analytics data is stored as WordPress post meta:
Historical Data
The plugin maintains detailed logs:
Views Log Format:
`json
[
{
“timestamp”: “2025-11-28T14:32:10Z”,
“ip”: “192.168.1.1”,
“user_agent”: “Mozilla/5.0…”,
“referrer”: “https://google.com”
}
]
`
Conversions Log Format:
`json
[
{
“timestamp”: “2025-11-28T14:35:22Z”,
“goal”: “signup”,
“data”: {“email”: “user@example.com”},
“ip”: “192.168.1.1”
}
]
`
Advanced Analytics Features
Conversion Rate Calculation
The plugin automatically calculates conversion rate:
Formula: (Total Conversions / Total Views) × 100
Example:
Date Range Filtering
Query analytics data for specific periods:
`php
// Get analytics for a date range
$analytics = ShahiLandin\Frontend\Analytics::getanalyticsdata(
$post_id,
‘2025-11-01’, // Start date
‘2025-11-30’ // End date
);
`
Export Analytics Data
Export analytics to CSV:
CSV Includes:
Integration with External Analytics
Google Analytics 4
Configure GA4 integration:
Features:
Mixpanel
Enable Mixpanel tracking:
Events Sent:
Facebook Pixel
Add Facebook Pixel to landing pages:
`html
`
Note: Requires administrator privileges and “Allow Scripts” enabled during HTML import.
Privacy & GDPR Compliance
Data Collection
By default, ShahiLandin collects:
Privacy Controls
Disable IP Collection:
Add this to your theme’s functions.php:
`php
addfilter(‘shahilandinanalyticscollectip’, ‘_returnfalse’);
`
Anonymize IP Addresses:
`php
addfilter(‘shahilandinanalyticsanonymizeip’, ‘_returntrue’);
`
Data Retention:
Configure how long to keep analytics data:
Cookie Consent
ShahiLandin respects consent banners:
Integration with Cookie Plugins:
The analytics script checks for consent cookies:
`javascript
// Analytics only runs if consent is granted
if (typeof cookieconsent !== ‘undefined’ && cookieconsent.hasConsented()) {
ShahiLandinAnalytics.init();
}
`
Compatible with:
Performance Considerations
Caching
Analytics tracking bypasses page caches:
Database Optimization
Keep analytics data optimized:
Asynchronous Loading
The analytics JavaScript loads asynchronously:
`html
`
This prevents blocking page rendering.
Troubleshooting Analytics
Views Not Tracking
Check if analytics is enabled:
Check for caching issues:
Check for bot filtering:
Conversions Not Recording
Verify conversion elements:
Check JavaScript errors:
Test manually:
`javascript
// Run this in browser console
ShahiLandinAnalytics.trackConversion(‘test’);
`
Inaccurate Conversion Rates
Duplicate views:
Bot traffic:
Analytics Settings Reference
Global Settings
| Setting | Default | Description |
|———|———|————-|
| Analytics Enabled | true | Master switch for analytics system |
| Track Views | true | Count page views |
| Track Clicks | true | Record button and link clicks |
| Data Retention | Forever | How long to keep analytics data |
| Anonymize IPs | false | Hash IP addresses for privacy |
External Integration Settings
| Setting | Default | Description |
|———|———|————-|
| Mixpanel Token | Empty | Mixpanel project token |
| GA4 Measurement ID | Empty | Google Analytics 4 measurement ID |
| GA4 API Secret | Empty | GA4 Measurement Protocol secret |
| Slack Webhook | Empty | URL for operational alerts |
REST API Endpoints
Tips for Better Analytics
—
For A/B testing analytics, see the Experiments & A/B Testing article.
Share this article
Still need help?
Our support team is ready to assist you with personalized guidance for your workspace.