Skip to content

Piwik page tracking

Sam Goshorn edited this page Sep 6, 2016 · 8 revisions

Following the pattern for starting a CALI Author lesson which is this:

https://www.cali.org/lesson/run/EVD04/528/jq

we call Piwik whenever the lesson changes page by sending a URL in a similar form:

https://www.cali.org/lesson/run/EVD04/528/jq/page/About this lesson
https://www.cali.org/lesson/run/EVD04/528/jq/page/Negligence Q1

using this code in the page changing logic:

var piwikURL ='/lesson/run/'+ book.lesson +'/'+lid+'/jq/page/'+escape(page.name);
_paq.push(['setCustomUrl', piwikURL]);
_paq.push(['setDocumentTitle',  book.lesson + ' | ' + escape(page.name) ]);
_paq.push(['trackPageView']); 

https://github.com/CCALI/CALI-Author-Viewer-5/commit/f8bd8c82b430062747422fc50394c6d0e5085244#diff-a49007cca57d1f47c22022a73b8472e3R317

The /page is added as a convenient way to filter so /jq/page/ would return only lesson page visits.

Clone this wiki locally