[ANSWERED] Custom url as pageView


(Twan Coenraad) #1

Hi,

Is it an idea to create an option to customize the urls that gets logged. So instead of just calling piwikTracker.trackPageView() piwikTracker.trackPageView(url).

Hope you’ll like this, and implement it style_emoticons/<#EMO_DIR#>/smile.gif


#2

Is this really needed ?
We can set the page title and the url of the page that is currently running the Piwik script is “captured” automatically by Piwik and that include URL that have been constructed by the server rewrite engine.

For exemple, say you have a site that do all it’s magic using only a single index.php file at the root and with some parameters like that :

http:/ /domain.com/index.php?action=search&key=test

The URL could easilly become :

http:/ /domain.com/index.php/search/test

using the rewrite engine.


(Twan Coenraad) #3

Actually because I only have an index.php. See this: http:/ /www.google.com/support/googleanalytics/bin/answer.py?answer=55576


(vipsoft) #4

You can already use:

  • trackPageView(customTitle)
  • setCustomUrl(customUrl)
  • setDocumentTitle(customTitle)

#5

Thanks Vipsoft for that answer, my preceeding reply was mainly because i didn’t found that information in the docs/faq pages.


#6

Silly me !
I was already using the setCustomUrl in my 404.htm file !
Full line :

piwikTracker.setCustomUrl('404/URL = '+encodeURIComponent(document.location.pathname+document.location.search) + '/From = ’ + encodeURIComponent(document.referrer));