Dynamic URL and page views

Hi,

we have a situation where our customer has a dynamic URL on their page, where the main part of the url stays the same but which changes when the user changes a selection of a product.

The problem is that Piwik records a page view everytime the URL changes which shows that that page has more views than it really has.

What would be the best practice to get around this?

You can turn off automatic tracking of page views and do manual one depedning on when you want to send them.
You’ll need to turn on manual page view tracking which you’ll find in Piwik PRO tag:

Then to send a page view you need to use this line of code:

_paq.push(["trackPageView"]);

You can create a custom code tag put this line in it and trigger the tag whenever the page view should be sent

Hi,

thanks for the answer.

Just to check that would turning off the Track page views in a single-page application-option from Data collection menu in administration also solve the issue? Or would that affect something else too?

If you have SPA on your site than they will not be tracked automatically after turning it off. Other than that nothing should be affected.

Okay thanks!

About your first solution.

The situation is that we have a page with a dynamic URL where the URL changes depending on which options the user has chosen on the page and the URL changes everytime the user changes any of the options. The URL uses a history hash and the URL changes after the hash when options are changed by the user.

In Google Analytics the page view tracking works as we want. But in Piwik this particular page has 3-4 times more page views because of the dynamic URL and this mess ups our analytics.

What would be the best practice to build this manual page view tracking so we get the page views right from this particular page and so that the other pages are tracked as well?

Toggling off the SPA option from the Data Collection did not have any effect on the page view tracking.

Hey,

getting back to this. That manual page tracking technically works, but in this case, the specific page already has a hash when it is accessed. Therefore, we cannot create a trigger that would only capture pages without a hash because otherwise we would not get any analytics for that particular page at all. The dynamic URL changes based on the user’s selection on the page, and often they also return to the original selection. Therefore, the trigger cannot be the entire URL of the page when it is accessed, as it repeats frequently. Do you have any ideas for this situation?