ZenphotoCMS Forum
piwik tracking for multilingual site - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: General support (https://forum.zenphoto.org/forum-4.html)
+--- Thread: piwik tracking for multilingual site (/thread-11791.html)



piwik tracking for multilingual site - vincent3569 - 15-05-2014

hi

I use this code to track my visitors with piwik:

`

var _paq = _paq || [];
_paq.push(['setDocumentTitle', ""]);
_paq.push(['enableLinkTracking']);
_paq.push(['setDownloadExtensions', "zip"]);
_paq.push(['trackPageView']);
(function() {
    var u = (("https:" == document.location.protocol) ? "https" : "http") + "://piwik.vincentbourganel.fr/";
    _paq.push(['setTrackerUrl', u + 'piwik.php']);
    _paq.push(['setSiteId', 3]);
    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);
})();

[Image: http://piwik.vincentbourganel.fr/piwik.php?idsite=2]

`
after some tests, I only want to track non translated title of all page names.
For all items (except albums, images, news and pages), it's easy to do: I have to use a 'static' title, instead of translated one with gettext (Accueil, Galerie, Archives,...).

But I have a trouble with albums, images, news and pages:
getBareAlbumTitle(), getBareImageTitle(), getBareNewsTitle() and getBarePageTitle() return translated value of the title.

How force the display title of albums, images, news and pages in only one language (french) to only track one title in piwik (I have other informations for tracking the country of my visitor)?




piwik tracking for multilingual site - acrylian - 15-05-2014

You would have to use the class method like $obj->getTitle('') to get a specific one.




piwik tracking for multilingual site - vincent3569 - 16-05-2014

thanks acrylian
a little more complicated than getBareAlbumTitle() (and other), but it works fine.




piwik tracking for multilingual site - acrylian - 16-05-2014

Yes, this hte hte "base" way of the object model behind everything. The "bare" function mean only that the display is "sanitized" but it is the current language always.