Quantcast
Channel: Zenphoto forum
Viewing all articles
Browse latest Browse all 2917

vincent3569 on "piwik tracking for multilingual site"

$
0
0

hi

I use this code to track my visitors with piwik:

<!-- Piwik Tracking Code -->
<script type="text/javascript">
	var _paq = _paq || [];
	_paq.push(['setDocumentTitle', "<?php
		if (($_zp_gallery_page == 'index.php') && ($isHomePage)) {echo gettext('Home'); }
		if (($_zp_gallery_page == 'index.php') && (!$isHomePage)) {echo gettext('Gallery'); }
		if ($_zp_gallery_page == '404.php') {echo gettext('Object not found'); }
		if ($_zp_gallery_page == 'album.php') {echo getBareAlbumTitle(); }
		if ($_zp_gallery_page == 'archive.php') {echo gettext('Archive View'); }
		if ($_zp_gallery_page == 'contact.php') {echo gettext('Contact'); }
		if ($_zp_gallery_page == 'favorites.php') {echo gettext('Favorites'); }
		if ($_zp_gallery_page == 'gallery.php') {echo gettext('Gallery'); }
		if ($_zp_gallery_page == 'image.php') {echo getBareAlbumTitle() . '|' . getBareImageTitle(); }
		if (($_zp_gallery_page == 'news.php') && (!is_NewsArticle())) {echo gettext('News'); }
		if (($_zp_gallery_page == 'news.php') && (is_NewsArticle())) {echo '|' . getBareNewsTitle(); }
		if ($_zp_gallery_page == 'pages.php') {echo getBarePageTitle(); }
		if ($_zp_gallery_page == 'password.php') {echo gettext('Password Required...'); }
		if ($_zp_gallery_page == 'register.php') {echo gettext('Register'); }
		if ($_zp_gallery_page == 'search.php') {echo gettext('Search'); }
	?>"]);
	_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);
	})();
</script>
<noscript><p><img src="http://piwik.vincentbourganel.fr/piwik.php?idsite=2" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Tracking Code -->

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)?


Viewing all articles
Browse latest Browse all 2917

Trending Articles