Hi All,
First of all, I am a newbie, and have just started playing with Javascript. I am looking at integrating piwik with flowplayer.
My desire:
Be able to track when visitors start/stop videos, the time of the video and then what they did afterwards. I can then use this for A/B testing … which videos are better at getting people to convert, and at what points within the video do they defect.
What I’ve done:
Customized Flowplayer, added 2 piwik goals (video start and video stop) with the “Goal can be updated more than once per visit”.
Question:
I am now thinking of adding a custom variable (video time) which is updated anytime the video is started or stopped, and then using piwikTracker.trackGoal(1 for start, 2 for stop) to get the time into the database, which I could then query.
However, I can’t figure out how to set the custom variables. I tried both of the below:
On each start/stop:
1)
try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 1);
piwikTracker.setCustomVariable(1, "tm", this.getTime(), "page" );
piwikTracker.trackGoal(2);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
} catch( err ) {}
Or
piwikTracker.setCustomVariable(1, "tm", this.getTime(), "page" );
piwikTracker.trackGoal(2);
What is the right way? Any advice?
Thank you!
David
P.S. I will provide a description of my methods once I get this working.