How to set custom url in web app (for SmartTV)

I am currently having trouble getting Piwik to record a custom URL. In the Piwik Dashboard when looking at the visitor profile I am receiving the data for the document title but underneath it am being shown ‘Page URL not defined’.

I can see in the developer tools Network window that ‘action_name’ is being populated by my page title and that ‘url’ is being populated with my custom URL but the custom URL is not being displayed in the dashboard.

The app I am developing is for Smart TV so the ‘url’ variable in the tracking request is being pre-pended with the protocol ‘file:///’ in the developer tools Network tab. Is it this that might be causing the URL to not reach the dashboard?

Any help in the right direction would be much appreciated! Thanks very much.

In index.html:


<script type="text/javascript">
  var _paq = _paq || [];
  _paq.push(["trackPageView"]);
  _paq.push(["enableLinkTracking"]);
  (function() {
    var u=(("https:" == document.location.protocol) ? "https" : "http") + "://my.server.address.here/analytics/";
    _paq.push(["setTrackerUrl", u+"piwik.php"]);
    _paq.push(["setSiteId", "mySiteId"]);
    var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0]; g.type="text/javascript";
    g.defer=true; g.async=true; g.src=u+"piwik.js"; s.parentNode.insertBefore(g,s);
  })();
</script>

In my respective subpages:


_paq.push(['setCustomUrl', 'customHomepageURL']);
_paq.push(['setDocumentTitle', 'Homepage']);
_paq.push(['trackPageView'])

Query String Parameters sent to Piwik:


action_name=Homepage&idsite=2&rec=1&r=670044&h=20&m=33&s=39&url=file%3A%2F%2F%2Fhome%2Fsmarttv%2FApps%2Fmy_smart_tv_app%2FcustomHomepageURL&_id=25dab85f47f1a885&_idts=1418741129&_idvc=7&_idn=0&_refts=0&_viewts=1418823775&send_image=0&pdf=0&qt=0&realp=0&wma=0&dir=0&fla=0&java=1&gears=0&ag=0&cookie=1&res=1248x819&gt_ms=1616

In the Piwik Dashboard (visitor profile):

  1. Homepage
    Page URL not defined

Hi there, when definining a custom URL please make sure it looks like a URL such as http://customurl/page

Matt,

Thank you very much. That works perfectly and thanks for Piwik!