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

getVisitorId() with asynchronous javascript (no replies)

$
0
0
Hi! I know this is probably a really basic question, but I am relatively new to Piwik and need to access the visitor ID so I can pass it in a form on my page. The rest of the tracking is working fine with this code. I am using the default code provided by my piwik control panel:

<!-- Piwik -->
	<script type="text/javascript">
	  var _paq = _paq || [];
	  _paq.push(["trackPageView"]);
	  _paq.push(["enableLinkTracking"]);

	  (function() {
		var u=(("https:" == document.location.protocol) ? "https" : "http") + "://12a-gisr.com/analytics/";
		_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.js"; s.parentNode.insertBefore(g,s);
	  })();
	</script>
	<noscript><img src="http://12a-gisr.com/analytics/piwik.php?idsite=1&amp;rec=1" style="border:0" alt="" /></noscript>
<!-- End Piwik Code -->


How would I go about getting the visitor ID piwik has assigned to the user?

I have tried this:

<script>
	$(window).load(function(){ 
	alert(piwikTracker.getVisitorId());
	});
</script>

But it doesn't appear to be working. Any ideas? Thanks!

Viewing all articles
Browse latest Browse all 4243

Trending Articles