Ptengine Measurement Configuration Guide for SPA Sites
Ptengine Measurement Configuration Guide for SPA Sites
What is an SPA Page?
SPA stands for Single Page Application.
In order to optimize content delivery speed and improve the overall performance of websites, the use of SPAs is becoming increasingly common these days.
Why Special Configuration is Required for Measuring SPA Pages
Because SPAs load content in a different way than traditional websites, standard measurement methods cannot detect SPA page content changes and URL changes by default, which also affects the proper analysis of user behavior. Similarly, Ptengine cannot properly measure SPA pages with standard basic tags and requires special configuration.
As a solution, by configuring the Ptengine SPA-compatible tag, when page content changes, the SPA-compatible tag will fire and send information such as the updated page URL to Ptengine, allowing for proper measurement. Specific configuration methods are introduced below.
Explanation of Implementation Logic
After the Ptengine basic tag is loaded on an SPA page, the Ptengine SPA-compatible tag is called from the "router change" function at the moment the page changes.
Google Tag Manager (hereinafter referred to as GTM) can easily identify history changes, so we recommend setting this as a trigger. Of course, manual configuration is also possible, but it requires cooperation from your technical team.
Warning:
If the page content changes but the URL does not change, you can use the tag below to generate a demo URL and then measure data with the new URL. However, please note that GTM cannot be used and manual configuration will be required. For details on "URL/#location information", please refer to the setPVTag section in this document.
window._pt_sp_2 && window._pt_sp_2.push('setPVTag,URL/#location information,replace');
Configuration Method with GTM
Create a new tag in the GTM container where the basic tag is configured.
After setting the tag name, select "Custom HTML", enter the tag below, set the trigger to "History Change", and save.
After confirming there are no issues, click the "Publish" button to publish.
Manual Configuration Method
It is also possible to fire setPVTag manually, so when configuring manually, add the following tag to your page logic so that the Ptengine SPA-compatible tag is called from the "router change" function at the moment the page changes.
If the page content changes but the URL does not change, use the tag below. For details on "URL/#location information", please refer to the "setPVTag" section in the document here.
最終更新