Hi!
I’m using Piwik 1.5 and would like to track manually added goals asynchronously. Here is my code:
In the page:
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(['setSiteId', 1]);
_paq.push(['setCookieDomain', '*.mysite.net']);
_paq.push(['trackGoal', 1]);
_paq.push(['setCustomVariable', 1, "logged_in", "true"]);
</script>
In the external JS file:
var _paq = _paq || [];
$(document).ready(function() {
var u=(("https:" == document.location.protocol) ? "https://piwik.mysite.net/" : "http://piwik.mysite.net/" );
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['enableLinkTracking']);
_paq.push(['trackPageView']);
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);
});
Everything works fine, even the custom variables. But no goals
Any ideas?
Thanks,
iGEL