|
SMFHacks Analytics for Google
smfhacks_analytics.zip
|
| Filesize: 28.94kB Views: (562) Downloads (4986) Last Download: Today at 05:16:52 pm
|
| Previous Download | Next Download
|
|
|
Description: SMFHacks Analytics for Google Version: 1.0.0 Author: vbgamer45 - https://www.smfhacks.com License: MIT Compatible with: SMF 2.1.x
Description
A comprehensive Google Analytics 4 (GA4) integration for Simple Machines Forum. This modification provides deep analytics tracking, server-side event collection via the Measurement Protocol, Google OAuth2 API access, and in-admin reporting - all without modifying any core SMF files.
Features
Tracking
- GA4 tracking code (gtag.js) automatically injected on all forum pages
- Track registered members across devices using their user ID
- Track which theme/style users are using
- Track boards via custom GA4 dimension
- Track topics via custom GA4 dimension
- Track user groups with configurable priority ordering
- Client-side error tracking (JavaScript errors, console errors, failed image loads, unhandled promise rejections)
Event Tracking
- User registrations (sign_up event)
- User logins (login event)
- New topic creation (create_content event)
- New reply/post creation (create_content event)
- Personal messages sent (create_content event)
- Attachment downloads tracked server-side via Measurement Protocol (file_download event)
- Paid subscription views, checkout, and purchases tracked as GA4 eCommerce events (view_item_list, begin_checkout, purchase)
- UTM parameters automatically added to links in outgoing forum emails
Google Analytics API Integration
- OAuth2 authentication using your own Google Cloud credentials
- Browse and select existing GA4 properties from your Google Analytics accounts
- Create new GA4 properties and data streams directly from the admin panel
- Measurement Protocol API secret auto-generated
- Custom dimensions automatically created in your GA4 property (board_id, topic_id, style_id, user_group_id, user_id, and error tracking dimensions)
In-Admin Reporting
- Dashboard - Realtime visitor map showing active users by country (Google GeoChart, auto-refreshes every 30 seconds)
- Charts - Configurable line charts with date range, dimension (OS, browser, country, city, page, device, language, board, topic), metric (page views, sessions, active users, events, new users), and minimum value filter
- Heat Map - Weekly activity heatmap (hour of day x day of week) with configurable metric, weeks of data, and end date
- Errors - Client-side error report showing error type, message, page URL, location, line number, and occurrence count
Requirements
- SMF 2.1.x
- PHP 7.0+ with cURL extension enabled
- A Google Analytics 4 property (created automatically or select an existing one)
- Google Cloud OAuth2 credentials (Client ID and Client Secret) - see setup instructions below
Installation
1. Install via SMF Package Manager (Admin > Packages > Install a Package) 2. After installation you will be redirected to the settings page
Setup Instructions
Step 1: Create Google Cloud OAuth Credentials 1. Go to Google Cloud Console - Credentials 2. Create a project (or select an existing one) 3. Enable the following APIs: - Google Analytics Admin API - Google Analytics Data API 4. Go to Credentials > Create Credentials > OAuth 2.0 Client ID 5. Application type: Web application 6. Add your forum URL as an Authorized redirect URI: https://yourforum.com/index.php?action=smfhacks_analytics;sa=oauth_callback 7. Copy the Client ID and Client Secret
Step 2: Configure the Modification 1. Go to Admin > Configuration > Analytics for Google > Settings 2. Enter your OAuth Client ID and Client Secret 3. Click Save 4. Click "Link Google Account" and authorize access 5. Select an existing GA4 property or create a new one 6. The Measurement ID and API Secret will be auto-populated 7. Custom dimensions are automatically created in your GA4 property 8. Configure which tracking features and events you want enabled 9. Set user group priority order if desired
Step 3: Enable Enhanced Measurement (Recommended) In your Google Analytics account: 1. Go to Admin > Property > Data Streams 2. Click your web data stream 3. Enable Enhanced Measurement for automatic tracking of scrolling, outbound clicks, site search, video engagement, and file downloads
How It Works
Client-side tracking: The gtag.js script is injected on every page via SMF's integrate_load_theme hook. Custom dimensions (board, topic, style, user group) are set based on the current page context.
Event queue: Forum actions (login, registration, topic/post creation, PMs) are queued in the PHP session and fired as gtag() calls on the user's next page load.
Server-side tracking: Attachment downloads and paid subscription purchases are tracked via the GA4 Measurement Protocol directly from PHP, since these actions don't render a page.
Reporting: Admin report pages fetch data from the Google Analytics Data API via an AJAX proxy endpoint, keeping page loads fast.
100% hook-based: This modification uses 14 SMF integration hooks and does not modify any core SMF files.
Hooks Used
- integrate_actions
- integrate_admin_areas
- integrate_load_theme
- integrate_pre_javascript_output
- integrate_pre_css_output
- integrate_login
- integrate_register_after
- integrate_create_topic
- integrate_create_post
- integrate_personal_message_after
- integrate_download_request
- integrate_outgoing_email
- integrate_exit
- integrate_daily_maintenance
Uninstallation
Uninstall via SMF Package Manager. All hooks are automatically removed, all files are deleted, and all settings are cleaned from the database. No traces are left behind.
Support
For support, bug reports, and feature requests visit https://www.smfhacks.com
Changelog
1.0.0 - Initial release
- GA4 tracking code injection with custom dimensions
- Google OAuth2 integration with property selection and creation
- Forum event tracking (login, registration, topics, posts, PMs, downloads)
- Client-side error tracking
- Paid subscription eCommerce tracking
- Email UTM tagging
- In-admin reporting (dashboard, charts, heat map, errors)
Discussion Topic: View Topic Posted by: SMFHacks March 31, 2026, 03:56:58 pm Author: vbgamer45 SMF Version: 2.1 License: MIT
Rating: This download has not been rated yet.
|
| 0 Members and 1 Guest are viewing this files. |
Comments (0)
|
[Mod]ActivityPub Federation for SMF 2.1
by SMFHacks
October 01, 2026, 05:03:45 pm
|
Newsletter Pro 4.0 Released
by SMFHacks
September 23, 2026, 08:08:24 pm
|
Can't remove or restore any item from the recycle bin
by SMFHacks
September 22, 2026, 11:01:51 am
|
MCP Server for SMF 2.1 - let Claude, ChatGPT or Cursor run your admin chores
by SMFHacks
September 12, 2026, 02:50:45 pm
|
Suggestions for improvements to Ultimate Shoutbox & Chatroom
by davejo
September 02, 2026, 01:35:09 am
|
Automatic Sorting of Categories
by Kiwi
August 31, 2026, 12:36:09 am
|
' appears as ' in Most Viewed (and Recent Items ?)
by SMFHacks
August 22, 2026, 11:01:56 pm
|
[Mod]Block Proxy VPN On Registration
by Alistair
August 21, 2026, 12:36:09 pm
|
SMFHacks error messages
by pete
August 16, 2026, 02:43:37 pm
|
Missing the line of buttons for editing on mobile
by SMFHacks
August 10, 2026, 05:53:25 am
|
|
|