How to specify custom page URL

If your website uses a querystring-based routing, since our script by default strips all the default querystrings (made exception for UTM parameters) from the URL, you will need to manually map your URLs through the "u" parameter of our script.

For example, if your URLs are like "/page.php?url=123&param=hello", you can push them like this: "/page.php/url/123/param/hello". This can be customized through any function you want (via javascript or via your backend directly), so it can be used also to aggregate some different URLs visitors to a unique URL: this can be the case if you have a rel="canonical" on your page and want to push all the visits to the canonical URL, or if you want to remove specific portions (e.g. IDs) from URLs you push to Publytics.

<script defer data-domain="example.com/EXMPL1" src="https://api.publytics.net/js/script.manual.min.js"></script>
<script>
    window.publytics = window.publytics || function() { (window.publytics.q = window.publytics.q || []).push(arguments) };
    publytics('pageview', {u: "https://publytics.net/your-custom-url" + window.location.search});
</script>

In this basic example, we push all the pageviews to a single chosen URL, and window.location.search is used to persist the query parameters for UTM source identification. If you need to manually map your URLs and you don't know how to proceed, please Contact us.