Piwik Tracking JavaScript features

Get Started. It's Free
or sign up with your email address
Piwik Tracking JavaScript features by Mind Map: Piwik Tracking JavaScript features

1. Measure the time spent on each page

1.1. _paq.push(['enableHeartBeatTimer']);

1.1.1. defaut: 15s/request

1.2. _paq.push(['enableHeartBeatTimer', 30]);

2. Trigger events manually (trackEvent)

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

2.2. examples

2.2.1. users click on a JavaScript link

2.2.2. users click on a tab (trigger a JS event)

2.2.3. users interact with elements of UI

2.3. https://piwik.org/docs/event-tracking/#tracking-events

2.4. other interactions

2.4.1. tracking download https://piwik.org/faq/new-to-piwik/faq_47/

2.4.2. tracking outlinks (click external websites) https://piwik.org/faq/new-to-piwik/faq_71/

2.4.3. tracking Video & Audio Players https://piwik.org/docs/media-analytics/ Media Analytics plugin

2.4.4. tracking Ads, HTML blocks using Content Tracking https://piwik.org/docs/content-tracking/ determine the performance of the pieces of content on any page of the website or app. content impression content interaction

3. Trigger goals conversions

3.1. https://piwik.org/docs/tracking-goals-web-analytics/

3.2. Goals in Piwik are defined as "matching" parts of the URL (starts with, contains, or regular expression matching). You can also track goals for given page views, downloads, or outlink clicks.

3.3. examples

3.3.1. user submit a form

3.3.2. user has stayed more than a given amount of time on the page

3.3.3. user does some interaction in Flash app

3.3.4. user has submitted his cart and has done the payment

4. Custom page name (setDocumentTitle)

4.1. _paq.push(['setDocumentTitle', document.title]); _paq.push(['trackPageView']);

4.2. _paq.push(['setDocumentTitle', document.domain + "/" + document.title]); _paq.push(['trackPageView']);

4.3. _paq.push(['setDocumentTitle', "<?php echo $myPageTitle ?>"]); _paq.push(['trackPageView']);

5. Tracking HTTP API

5.1. https://developer.piwik.org/api-reference/tracking-api

6. Ecommerce tracking plugins

6.1. https://piwik.org/docs/ecommerce-analytics/

6.2. Ecommerce software platforms

6.2.1. Magento

6.2.2. Zencart

6.2.3. OXID esales

6.2.4. PrestaSHOP

6.2.5. OSCommerce

7. Internal Search Tracking

7.1. track how your visitors use your internal website search engine.

8. Custom variables

8.1. scope: visit

8.1.1. setCustomVariable(index, name, value, scope = "visit") _paq.push(['setCustomVariable', // Index, the number from 1 to 5 where this custom variable name is stored 1, // Name, the name of the variable, for example: Gender, VisitorType "Gender", // Value, for example: "Male", "Female" or "new", "engaged", "customer" "Male", // Scope of the custom variable, "visit" means the custom variable applies to the current visit "visit" ]); _paq.push(['trackPageView']);

8.2. scope: page

8.2.1. setCustomVariable(index, name, value, scope = "page")