Workaround for flash-website-tracking avaiable?

we want to replace google-analytics with Piwik on our own servers. But, we have a lot of websites which are fully made in flash (AS2,AS3) where i implemented the google-eventTracking and pageTracking. Now i want to do the same for piwik, so that we can recognize what a user is doing on the site.

My first try was to call a java-script function, which is written into the index.html, so that a flash on(release) event calls that function:

<!-- Piwik -->
<script type="text/javascript">
try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 2);
} catch( err ) {}
function home() {
        piwikTracker.trackLink("home");   // otherwise
<!-- End Piwik Tag -->

Flash-Code: getURL(“java script:home();”);
didnt work.

2nd try was to call the pageTracker directly out of flash getURL(“java script:piwikTracker.trackPageView(’/home.html’);”);
didnt work.

Has anyone same problem or a workaround? Am i right in this forum? I did not find any help topics but a lot of support tickets which are tagged as invalid.

For example //full flash pages with working GA tracking and implemented function for piwik


When you used the getURL method, did you put the javascript code (containing var piwikTracker = Piwik.getTracker(…)) before your flash content? it is important to put the JS instanciation before.

What technique were you using to tag your flash content with GA?

trackLink takes 3 parameters, only the 3rd (custom_data) is optional.

At minimum, you need to also specify the link type (2nd parameter) as either ‘download’ or ‘link’. (If you write a custom plugin, you can, of course, define your own link types.)

okay ill try that and report.

And matthieu the GA and Piwik Code placed before every flash element. I think im not using an special technique, just the easy way and customize if needed: pageTracker._trackEvent(“Category”, “Action”, “Label”, “Value”);

[quote=mkuehl @ Jan 26 2010, 02:14 PM]…
Flash-Code: getURL(“java script:home();”);
didnt work.
it strikes me as odd that you are using “java script:” instead of “java script:” , is that valid in flash?

If it is, try something like alert in your javascript event, that should tell you if it is called at all.

sorry, it seems that the forum blacklists javascript with a colon and changes it to java script so that is not the reason for the problem.

i found a solution but it has only one parameter. Thats not so fine but okay, it works an i can track everything on the flash websites.

getURL(“java script:piwikTracker.setDocumentTitle(‘Link - Newsletter’); void(0);”);

why do you put void(0); ? is it because the Piwik functions do not return any values? does it work without the void(0)?


Sorry to bump this 1 year old thread.

The website I track with piwik is also in flash and I wanted to know how do I implement the workaround discovered by mkuehl.

What I want to track the most are downloads. The way I have things setup is that when a visitor clicks a button, they download a .rar file.

So the action for the button is:

on (release) {
getURL(“”, “_blank”);

How can I implement this workaround in flash so I can track downloads with piwik?

Ok, so I tried modifying the action like this:

on (release) {
getURL(“javascript:piwikTracker.setDocumentTitle(‘Download’); void(0);”);
getURL(“”, “_blank”);

I get to download the file but nothing is tracked. Anybody has any ideas?

Ok I got something to work but not quite what I was expecting:

On my flash website I setup an action button to do the following:

on (release) {
getURL(“javascript:piwikTracker.trackPageView(’/folder/File Downloaded ');”);
getURL(“”, “_blank”);

While testing it, the page title counted one hit for “folder/File Downloaded”

I guess I could track downloads that way but the ideal solution would be to actually trigger the Downloads under Actions because that would trigger a goal.

So instead of using “javascript:piwikTracker.trackPageView(’/folder/File Downloaded ')” what can I use instead to track downloads correctly?

Any help is greatly appreciated as I’m literally pulling my hair on this one.


I have the same problem. I just do not get it.
Who can help?

getURL(“java script:piwikTracker.setDocumentTitle(‘Downloads/bka.jpg’); void(0)”);

Thank you Andreas


ich habe das gleiche Problem. Ich bekomme es einfach nicht hin.
Wer kann helfen?

getURL(“java script:piwikTracker.setDocumentTitle(‘Downloads/bka.jpg’); void(0)”);

Danke Andreas

Assuming you are using the asynchronous tracking code:

getURL("javascript:_paq.push(['setDocumentTitle', 'Downloads/bka.jpg']); void(0)"); 

Hi Fabian,

auch das funktioniert nicht. Ich bin schon am verzeifeln.

Gruß Andreas

Nochmal probieren, hat eine Klammer gefehlt. Wenn du Fehlermeldungen bekommst, wäre es hilfreich diese auch zu posten.

Try again, there was a left parenthesis missing. If you get any error messages, please report them here as well.

Hi Fabian,

auch mit der Klammer funktioniert es nicht. Fehlermeldung gibt es keine.

Gruß Andreas

Hi Fabian,

with the clip, it does not work. There is no error message.

Greetings Andreas


hier noch einmal mein Piwik-Code:

<!-- Piwik -->
<script type="text/javascript"> 
  var _paq = _paq || [];
  (function() {
    var u=(("https:" == document.location.protocol) ? "https" : "http") + "://";
    _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);
<noscript><p><img src="[]; style="border:0" alt="" /></p></noscript>
<!-- End Piwik Code -->

und hier mein Button-Code:

on (release) {
    getURL("javascript:_paq.push(['setDocumentTitle', '/Downloads/bka.jpg']); void(0)"); 
    file = "Bergknappenabend";
    getURL("download.php?id=1", "_parent");

vielleicht habe ich da einen Fehler drin.

Gruß Andreas