Download

Documentation

Print This page

Getting Google Analytics Stats for Specific Page or Post ID Using Analytify Shortcodes

Are you looking for how to get Google Analytics Stats for Specific Page or Post ID Using Analytify Shortcodes? If yes, you’re at the right place.

Analytify is a powerful tool for WordPress theme developers and website administrators. It gives detailed data that helps you track your website. You can use Analytify shortcodes to see Google Analytics Stats for specific Page and Post. This guide will walk you through each step.

Requirements

Why You Need Google Analytics Stats for Specific Page/Post

You might want to show Google Analytics specific page stats for many reasons. You might want to show your users how many people visit a landing page or to gauge people’s interest in a product or service. No matter the reason, picking out and analyzing the performance of a specific post or page is an invaluable part of a data-driven decision.

Shortcode to Show Google Analytics Specific Page Stats

Analytify adds a number of shortcodes that each give a different kind of Google Analytics data. We’ll use the following shortcode to get stats for a specific post or page ID.

[analytify-stats metrics="totalUsers" date_type="custom" start_date="2023-03-20" end_date="2023-07-20" analytics_for="page_id" custom_page_id="1"]

Note: The start and end dates are set as an example. You can set your desired custom dates.

The metrics attribute lets you choose which data to get. In this case, totalUsers will tell you how many visitors there have been. 

start_date and end_date tell you how long you want the stats to cover.

You put the ID of the post or page you want to look at in the page_id field.

Finding the Post or Page ID

To find the ID of a post or page, go to your WordPress Dashboard. Hover over the title of the post or page whose ID you want to find. Look at the URL. The numerical part is the ID of the post or page. Once you have the ID, you can use the shortcode.

how to get post id

Now, let’s know how to add the Shortcode. It’s simple and straightforward.

How to Add the Analytify Shortcode

  1. Go to the text editor of your post or page where you want to get Google Analytics stats.
  2. Then, select the Analytify Shortcodes block from your post editing bar.
analytify shortcodes
  1. After clicking the Analytify Shortcodes block, a sidebar will open on the right side of the page, as shown below.
Analytify shortcode to get google analytics stats for specific page

Note: This block also generates automatic shortcodes, which only support Universal Analytics. We are working to develop a new block for GA4 support. You can contact us for GA4 equivalent shortcodes until we develop an automated solution.

For now, let’s add the code manually provided by our developer team.

Simply copy and paste the below code into your post after selecting the analytify shortcode block. 

[analytify-stats metrics="totalUsers" date_type="custom" start_date="2023-03-20" end_date="2023-07-20" analytics_for="page_id" custom_page_id="1"]

Note: The start and end dates are set as an example. You can set your desired custom dates.

Google Analytics Stats for specific Page or Post

After adding the shortcode, you can either publish your new page or post or click Update on a current page or post.

And you’ll start getting stats for your post, can use a shortcode to show  Google Analytics Stats for specific Page or Post.

The Analytify shortcode’s ability to show data for a single post or page gives you a unique level of detail that lets you keep a close eye on your website’s performance. We hope this article helped you to learn how to use Analytify shortcode to show Google Analytics Stats for specific Pages and Posts.