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

Accessing Piwik singleton when using async tracker (1 reply)

$
0
0
I'm testing out the Piwik JS tracker, and wanted to play about with plugins.

I've set a test page up using the async tracking code and _paq[] configuration array, and it tracks ok, but when I try to access the Piwik object for using e.g. Piwik.addPlugin(), it throws a "Piwik is not defined" javascript error./

Is it possible to access the Piwik singleton when using the async method?

EDIT:

I'm currently using the

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


method to insert the piwik code. Should I be using document.write instead?

Viewing all articles
Browse latest Browse all 4243

Trending Articles