Track blog posts by authors and categories

Analytics + Tag Manager

When you want to see how blog authors and blog categories perform on your website, you can set up advanced tracking in Piwik PRO. In this article, we’ll show you how.

Find CSS attributes for an author and a category

First, you’ll need to note the CSS attribute for an author and a category on your blog. We’ll use these pieces of information to identify authors and categories during tracking.

To find the CSS attribute, follow these steps:

  1. Open your blog.
  2. Right-click on the blog author and click Inspect or Inspect element, depending on the browser you’re using.
  3. Look for the ID or class of the author element among the lines of code.
    CSS attributes for an author and a category
  4. The code could look like this: <span class="author">Jane Doe</span>. In this case, we’ve got the class author.
  5. Follow steps 1-4 to find the ID or class for a blog category. In our example, we’ve got the class category.

Add a variable in Tag Manager

Now you’ll need to add a variable that will pull out information about the author or category from the CSS element.

To add a variable, follow these steps:

  1. Go to Menu > Tag Manager.
  2. Navigate to Variables.
  3. Click Add new variable.
  4. Name the variable.
  5. Select the following variable type: DOM element.
    DOM element variable in Piwik PRO
  6. In Variable settings, set Element ID or CSS selector. In our example, we’ll use CSS selector.
    A variable in Tag Manager in Piwik PRO
  7. Check Extract text from an element. This option will pull out an author name or a category name.
  8. Click OK when you’re done.
  9. Repeat steps 1-8 to set a variable for a category.

Add a custom dimension in Analytics

In the next step, you’ll need to add two custom dimensions that will store information about a blog author and category. 

To create a custom dimension, follow these steps:

  1. Go to Menu > Analytics.
  2. Navigate to Settings.
  3. On the left, click Custom dimensions.
  4. In Event dimensions, click Add event dimension.
    Custom dimension in Analytics in Piwik PRO
  5. Name the dimension.
  6. Click Save.
  7. After creating the custom dimension, note its tracking ID.
    Custom dimension in Analytics in Piwik PRO
  8. Repeat steps 1-7 to set a custom dimension for a category.

Modify the tracking code in Tag Manager

As the last step, you’ll need to modify the tracking code so that it tracks your new custom dimensions.

To modify the tracking code, follow these steps:

  1. Go to Menu > Tag Manager.
  2. Navigate to Tags.
  3. On the left, click Piwik PRO. This is the tag with the tracking code.
  4. In Collect data for custom dimensions, click + Add a dimension.
    Add a dimension in Piwik PRO
  5. Enter Dimension ID and Dimension value.
    Custom dimensions in Piwik PRO

    Note: You can find the dimension ID under Analytics > Settings > Custom dimensions. As the dimension value, use the created variable.

  6. Scroll down to the bottom and click Save.
  7. Click Publish to make the changes go live.

    Note: You can also use a custom dimension tag to set up more custom tracking for your dimension.

See the custom dimension report

After everything is set, the tracker will start collecting data for your new custom dimensions, and it’ll report it under the custom dimension report.

To see the report, follow these steps:

  1. Go to Menu > Analytics.
  2. Navigate to Reports.
  3. On the left, click Custom dimensions.
  4. Pick the dimension you want to see.
    Custom dimension in Analytics in Piwik PRO

    Tip: You can also create a custom report and use your new custom dimensions.

Was this article helpful?

Technical support

If you still have some questions, visit our community.
There’s always someone ready to help!

Back to help center