Sometimes page titles in reports can be unclear, too long or contain too much or too little information. In these situations, you can create a custom page title that only appears in reports, but doesn’t change the original title on your website.
Let’s say we have two page titles 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:
- Go to Menu > Tag Manager.
- Navigate to Tags.
- Click Add a tag.
- Name the tag and select the following type: Custom code (async).
- Click Next.
- In Tag code, type the following code:
<script> _paq.push(['setDocumentTitle', "Custom page title"]); _paq.push(['trackPageView']); </script>
"Custom page title"with the title that you want to use. You can also use a variable instead.
Note: Bu default, Piwik PRO reads the page title from document.title, which is the text content of the
<title>element in the page’s source code.
- In Tag triggers, click Add a trigger.
- Name the trigger.
- In Trigger type, choose the following type: Page view.
- In Event conditions, define conditions for the trigger. In our example,
Page URL equals https://clearbank.com.
- When you’re done, click Save.
- Click Save for the tag.
- Test your tag in debug mode.
- When you’re happy with how the tag works, click Publish.
- Repeat steps 1–14 for the other page titles.
- Done! You’ll see custom page titles in Menu > Analytics > Reports > Pages.
Note: There are other methods for customizing page titles, but the one described in this article is the simplest. In more advanced cases, you may need to customize your tracking code and use a virtual page title with a variable. If you run into a problem like this, post a question on our community forum.