How to Track and Report Custom Events with Parameters in WP Statistics

How to Track and Report Custom Events with Parameters in WP Statistics

Why do you have to track and report custom reports while using advanced monitoring tools?

If you rely solely on the reports of web analytics tools, you’re likely missing some important metrics.

Almost all of these platforms, from GA4 to simple tools, focus on general metrics like traffic, visitors, and locations.

So, if you’re running marketing campaigns with specific goals, you have to think of another tracking method.

Thanks to advanced customization features that some tools like GA4 and WP Statistics offer, you can track custom events.

This article helps you get familiar with the importance of WordPress custom event tracking and learn to use WP Statistics custom reporting.

Why Track Custom Events in Web Analytics?

Although metrics like pageviews, sessions, and bounce rates are really useful, they tell only part of the story.

If you want to track real engagement in your campaigns, you have to track the micro-actions your visitors take on your website. 

For example, if you have a real estate directory website, you don’t have to just focus on the number of views or visitors. You can set custom events on any specific parameters on the website to track more details, like:

  • Cities that are more interesting to your users
  • Price ranges that users are looking for
  • Bedroom numbers that are more sought-after on the website

This advanced event tracking gives you insights into your visitors’ behavior and lets you make data-driven decisions.

This actionable data helps you improve your budgeting, marketing strategies, and future contracts.

This can be great for directory websites like real estate, doctor directory, multi-vendor e-commerce websites, etc.

Can WP Statistics Track and Report Custom Events with Parameters?

The short answer is a big Yes!

If you go Premium on WP Statistics and enable the Marketing Add-on, you can track and report custom events and include event parameters.

WP Statistics (via the Marketing Add-on) can store structured JSON data for each custom event.

Each event entry contains key-value pairs representing your parameters, such as area and bedroom number in the real estate example.

Alo, the plugin saves the event timestamp to help you track the trend. For instance, a record in the database might look like this:

{“Area”: “Vancouver”, “Bed”: “2 Beds”}

This JSON format lets WP Statistics store structured event data for analysis or saving as CSV charts.

Step-by-Step Guide to Tracking Custom Events + Examples

Now, let’s walk through the details of setting up and reporting custom events with parameters using WP Statistics.

We’ll consider the directory site scenario to explain how you can use WP Statistics to track and report custom events:

Step 1: Create Goal

First, register the custom event in WP Statistics. Go to Dashboard Statistics Goals Add New Goal.

Create Goals on WP Statistics for Custom Events

Here, you see several options, including:

  1. Click: Track clicks on a button, link, or element
  2. Pageview: Track when a page is loaded
  3. Event: Track a custom event (e.g., form submissions)

To set a custom event, click the third option and fill in the required areas: Goal Name and Machine Name.

In the real estate example, if you want to track the area, you can define a custom event like Area.

Finally, click Save to store the event. Remember that saving this event only defines the event in WP Statistics. To record data, you must trigger it from your code in JavaScript or PHP.

It should be noted that you can also register programmatically using the wp_statistics_custom_events filter in your theme’s functions.php.

Step 2: Add Custom JavaScript to Trigger the Event

You need to insert a small JavaScript snippet on your site. This script will automatically send the event data to WP Statistics when a visitor clicks the button.

Here is a simple code sample for the real estate sample to track which city/area users are exploring more:

// Define the event function
function trackAreaInterest(areaName) {
    if (typeof wp_statistics_event === 'function') {
        wp_statistics_event('property_area_interest', {
            area: areaName,
            timestamp: Date.now()
        });
    }
}

When writing the code, consider the following tips:

  • The event name should match a registered goal because unregistered names are ignored.
  • Use lowercase and underscore in the machine-name format and keep parameter keys short and predictable.
  • You have to avoid using reserved event names. Here are some of the reserved names:
page_viewuser_loginscrolladd_to_cartpurchase
video_startuser_logoutform_submittracking_eventfile_download
custom_eventvideo_progressclicksystem_eventnotification_open
session_startview_search_resultsanalyticsvideo_completeerror_event
user_engagementreserved_event

You have to put the JavaScript code directly into your WordPress site’s theme files.

It’s possible to add your tracking code to your theme by placing it in the functions.php file. You can link to a separate JavaScript file or paste the script right in the file.

The good news is that you can avoid editing your main theme. It’s possible to create a child theme and place the script there so that your script doesn’t change when you update the theme.

Step 3: Test & Verify Event Data Tracking

When you implement the script, you need to test it to make sure it can capture an event. You can do that by clicking a button yourself and checking the update in the Goals page.

Add New Goal

Here, you can see a list of goals with details like Type, Count, Conversion Rate, Creation Time, and Status.

If you see the name of your goal, it means that your event has been defined. When you define it using code, the plugin marks it as “Created by Code” under the Type column.

Step 4: Run the Campaign and Start Tracking Events

Now, you can start your campaign and track the events in your WP Statistics dashboard.

To do that, you just need to go to the Goals reporting section to see the results. Here, you can click View Details to track your goal.

In the tracking page, you can see various insights. In the real estate sample, if you have received a click on Vancouver, your results would be like:

Sample Goal

Here, you can see other details like:

MetricValueDescription
Browser UsageChrome: 1 (100%)Browsers visitors use
Most Used Operating SystemsWindows: 1 (100%)Operating systems visitors use
AreaVancouver: 1 (100%)Top clicked cities with percentage
Last ActivitiesSeptember 28, 2025, 3:42 pm – Page: AboutTimestamp 

Step 5: Export the Results

To have more control over your custom event tracking results, you can export the results to CSV or XML files.

To do that, go to Optimization under the Statistics menu. Then, click Data Export, and select events and the format you prefer.

Export Report as Custom Event

Tips for Organizing Custom Event Reports

Tracking custom events is not just about inserting code and using an add-on. You need to consider some factors when tracking custom events to do it correctly.

Here are the best practices when tracking custom events with parameters in WordPress:

Set SMART Goals

Before any campaign, you have to know what you want to be able to measure its performance.

So, it’s essential to determine your goals so that you can track them correctly. Your goals should be:

  1. Specific: You should clearly define what you want. For example, “how many users like a specific city”
  1. Measurable: You should determine metrics that you can measure. Try to quantify what you want from the campaign. For example, you can consider 100 clicks on the button for a month.
  1. Achievable: Try to be realistic when defining your goals. It’s important to consider your budget and other limitations. For instance, you can consider a 20% monthly increase in call clicks.
  1. Relevant: Your goals should align with your overall business culture and objectives.
  1. Time-bound: Set a deadline for your goals so that you can change your strategies if you don’t reach your objectives within that period.

Be consistent 

Keep your reports clean and use a consistent structure for defining events. For example, stick to lowercase, underscore-separated names. This way, your events can be interpreted more easily.

Conclusion

WP Statistics offers advanced tracking features that allow you to set up events through code. 

If you need more flexibility and more detailed insights, you just need to enable the Marketing Add-on on the WordPress dashboard and then create a custom report with parameters. 

You can insert a script on your website theme and send custom events to your dashboard to analyze the performance of your website, especially if you’re running a directory business. WP Statistics allows you to track each single action in WordPress and segment them to analyze your business performance with unprecedented detail. 

So, why wait? Enable the marketing add-on and track custom events with parameters at an affordable cost.

FAQs

How to check statistics in WordPress?

Install a plugin like WP Statistics. Then view reports directly from your WordPress dashboard. You can also use paid add-ons like Marketing and Data Plus for more advanced details.

Is WP Statistics free?

Yes, the plugin is free. However, extra features like advanced event tracking are paid for.

How to download stats from WordPress?

WP Statistics lets you export the reports and download them as CSV. Files.

How to track user activity on WordPress?

You can easily install WP Statistics on your dashboard to track details about your visitors. You can also use paid add-ons on WP Statistics to track more details using custom events with parameters.

Hossein Karami
Hossein Karami
Hossein is a writer specializing in digital marketing, SEO, and business growth. With a focus on data-driven content, he helps brands grow their online presence and reach.

Add Your Voice

Your comments help shape our community. Feel free to share your experiences, suggestions, or reactions in the comment box.

Let’s get started
Take your business to next level

Become part of our growing family of +600,000 users and get the tools you need to make smart choices for your website. Simple, powerful insights are just a click away.

Biggest Sale of the Year!

Get 40% Off on Premium Plans

Biggest Sale of the Year!

40% Off on Premium Plans