Quantcast
Channel: Piwik Forums - Support & Bugs
Viewing all articles
Browse latest Browse all 4243

Piwik proxy hide url script doesn't route custom variables ? :S (no replies)

$
0
0
I use the last version of the Piwik Proxy Hide Url script :
https://github.com/piwik/piwik/tree/master/misc/proxy-hide-piwik-url

The script is loaded asynchronously with javascript on my site pages :
// PIWIK async loading
var _paq = _paq || [];
_paq.push(["trackPageView"]);
_paq.push(["enableLinkTracking"]);
(function() {
	var u=(("https:" == document.location.protocol) ? "https" : "http") + "://www.mysite.com/";
    _paq.push(["setTrackerUrl", u+"piwik.php"]);
    _paq.push(["setSiteId", 1]);
    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.php"; s.parentNode.insertBefore(g,s);
})();

I have several custom variables on my pages associated with javascript events using jQuery.
e.g :
$('#mytarget').on('click', 'span', function(){
	_paq.push(["setCustomVariable", 1, "myTarget", $(location).attr("href"), "page"]);
	_paq.push(['trackPageView']);
	[…]
});

When the javascript event is fired (a click on the #myTarget span in my e.g), a GET request is sent to the piwik.php script (the proxy one) with the custom variable as parameter (and some other data).
The custom variable never make it to the database, it doesn't show up in the custom variables panel.

If I turn off proxy (in my PIWIK async loading snipet I switch "://www.mysite.com" to "://stats.mysite.com", my real Piwik server url, and the last occurrence of "u+piwik.php" to "u+piwik.js" ), my custom variables are recorded in the database and show up in panel.

Am I missing something ? Does someone has a working solution ?

Viewing all articles
Browse latest Browse all 4243

Trending Articles