Tracking button click

Hello everyone! style_emoticons/<#EMO_DIR#>/smile.gif

I have 2 questions:

  1. Is it possible to track down a button click that leads to a second site (of my website).

e.g.: A button/link on site1 leads to side2 and a button/link on site2 leads to site3…and so on…

The problem is that all different sides are displayed like “domain.com/side.php”.
So piwik can’t figure out, when I am actually visiting one of the sites.

  1. I have read about the 1x1 pixel counting. How can i do this in piwik? I can’t really use the ‘download tracking’ feature, because nobody is actually clicking on the pixel to download it directly. (Maybe the answer to my second question is also the solution to my first question).

Thank you guys!

ad 1
Tracking (a) page hits and visits to one site and (b) tracking links/buttons clicked on that site that lead to another site are two different things. That’s all explained in the docs and faqs. If both sites are yours, clicks counted on site 1 should also show as page hits on site 2.

Also, the only things piwik “figures out” are what it considers “unique visits” and “unique visitors” but the URL and pages are exactly what you tell the piwik server by the right piwik tag and by configuring your site IDs the way you want them.

ad 2
The 1x1 “Pixel counting” is not what (it appears that) you think. It’s an alternative means of communicating with the piwik server to tell it what it should do. What happens is that you use an tag to load a mini-picture into your page. You load it from the piwik server, and the corresonding request is loaded with all the parameters that otherwise would be sent through the javascript tag code. The “pixel” itself is meaningless. In other threads in this forum, the developers tell us that such an interface exists (or is under development), but is not documented (yet).

Thanks Burkhard for your reply!

Ups…i have actually been to the section ‘Force a click on a link to be recorded as a download in Piwik’ in the docs. I don’t know why i have not tried it style_emoticons/<#EMO_DIR#>/huh.gif

But now that i have… the problem seems to be, that my button is a button and not a link.

I tried anyway to add a download class. But it didn’t work. I also added a new class to the surrounding

containder of the button. But this also doesn’t work. style_emoticons/<#EMO_DIR#>/sad.gif

Is there a chance to get this to work anyway?

cheers
peewik

I am not completely familiar with how piwik.js hooks itself into the browser’s click handling. The devs will surely have a better answer than this. My way would be to implement the button in javascript with “onmousedown” executing what the button is supposed to do. From within such a button handler, you can explicitly call piwik to register the click.

Ok… it works now with onclick=“piwikTracker.trackLink( ‘URL’, ‘link’, ‘Test’ );”

Thank you for your help!

Hello,

I want to track a click on a submit button.
I am new to this coding stuff… how do I set up this tracker?
Adding a code into my website and then setting up a goal in Piwik?

For this little event I only need a piece of code on my button link?!
For example

<a href="#" onclick="javascript:_paq.push(['trackEvent', 'Menu', 'SendForm']);">SendForm</a>

…and then then the goal in the Piwik-backend?!

None of these other code snippets mentioned here?!.. JavaScript Tracking Client: Integrate - Matomo Analytics (formerly Piwik Analytics) - Developer Docs - v3

EDIT: Ok, now I found this here “tracking goals” it shows me some code snippets but doesn’t say where to put it…


// logs a conversion for goal 1
_paq.push(['trackGoal', 1]);