How to use custom page titles

Sometimes page titles are not clear in reports, and you want to tidy them up. By default, Piwik PRO takes the page title from document.title, which is the text content of the <title> element in the page’s source code. But these titles may be too long for you, have too much information or, in case of single-page applications, they may not change as the page content changes. In that case, you can create a custom page title that will appear in reports but won’t change the original title on the website.

Let’s say we have two page titles that we want to customize.

Page URL Page title Custom page title
clearbank.com Clear Bank | Best mobile banking app Home page
clearbank.com/product-tour Product tour | Clear Bank | Better mobile banking app Product tour

To create a custom page title, follow these steps:

  1. Go to Menu > Tag Manager.
  2. Navigate to Tags.
  3. Click + Create new tag.
  4. Name the tag and choose Custom asynchronous tag template.
  5. In Tag HTML code, type the following code:
  6. <script>
    _paq.push(['setDocumentTitle', "Custom page title"]);
    _paq.push(['trackPageView']);
    </script>

    Replace "Custom page title" with the title that you want to use. You can also use a variable here.

    A custom page title code in a tag in Piwik PRO.
  7. In Tag triggers, click + New trigger.
  8. Name the trigger.
  9. In Event type, choose the page view trigger.
  10. A trigger for a custom page title code in a tag in Piwik PRO.
  11. In Trigger conditions, define conditions for the trigger. In our example, Page URL equals https://clearbank.com.
  12. A trigger for a custom page title code in a tag in Piwik PRO.
  13. When you’re done, click Save for the trigger and click Save for the tag.
  14. Test your tag in debug mode.
  15. When you’re happy how the tag works, click Publish.

In our example, we would repeat this process for the other page to change its title. After that, we would see custom page titles in the reports, for example, in the page report (Menu > Analytics (new) > Reports > Pages)

Page report in Piwik PRO with custom page titles.

Note: There are other methods to customize page titles, but the one described in this article is the simplest. In advanced cases, you may need to adjust your tracking code and use a virtual page title with a variable. If you run into such an issue, contact us at support@piwik.pro, and we’ll come up with a custom solution for you.

Was this article helpful?

Be the first to rate this article.

Technical Support

If you have any questions, drop us a line at support_SPC@piwik_SPC.pro.

We’re happy to help!