How to track internal anchor links in visitor log

Hi guys,

on my latest project I make full use of “internal” anchor links on the landing page.

Right now piwik does not track those clicks.

My question:
Is there a javascript which would enable piwik to automatically track those clicks, p.e. as real url clicks?

Do you guys have any ideas for a general javascript?

By the way: I do not want to use goals for this as I would be very time consuming to set this up.

Thanks for your help
Marcus

what do you mean exactly, what links are not tracked?

You probably want this: http://piwik.org/docs/javascript-tracking/#toc-manually-trigger-a-page-view-on-click-or-on-js-event

[quote=matt]
what do you mean exactly, what links are not tracked?[/quote]

I am talking about anchor links that link to the same exact base-url - see my example below.

It would be really good to have a general tracking-script for the 3 anchors in the following example
WITHOUT having to apply the “onclick=“javascript:piwikTracker.trackPageView(‘Menu/Freedom’);”>” to each single link.

For example:


<html>
....

<a href="#anchor1">goto anchor1 - THIS LINKS WILL NOT BE TRACKED BY PIWIK</a>
<a href="#anchor2">goto anchor2 - THIS LINKS WILL NOT BE TRACKED BY PIWIK</a>
<a href="#anchor3">goto anchor2 - THIS LINKS WILL NOT BE TRACKED BY PIWIK</a>

<!-- ANCHOR 1 -->
<a name="anchor1"> 
<!- .... content .... !->

<!-- ANCHOR 2 -->
<a name="anchor2"> 
<!- .... content .... !->

<!-- ANCHOR 2 -->
<a name="anchor3"> 
<!- .... content .... !->

</html>

Any ideas?

Are the links on the pages to urls somewhere else on your site or are they to links offsite?

[quote=lesjokolat]
Are the links on the pages to urls somewhere else on your site or are they to links offsite?[/quote]

The links to the anchors & the anchors itself are all ON THE SAME site.

This is where the problem is as there is NO page-load event when clicking on them.

So I guess that there needs to be a javascript which tells piwik about the clicks.

Any ideas?

How about this?

Manually Trigger a Page View on Click or on JS Event

By default, Piwik tracks page views when the Javascript tracking code loads and executes on each page view. However, on modern websites or web applications, user interactions do not necessarily involve loading a new page. For example, when users click on a JavaScript link, or when they click on a tab (which triggers a JS event), or when they interact with elements of the user interface, you can still track these interactions with Piwik.

To track any user interaction or click with Piwik, you can manually call the Javascript function trackPageView(). For example, if you wanted to track a click on a JavaScript menu, you could write:

[…]
Freedom page