TakwimuAfrica / Takwimu

Takwimu is a free and open development information service, transforming access to high quality analysis and data for African changemakers. Accessible at https://takwimu.africa/
https://takwimu.africa/
GNU General Public License v3.0
13 stars 1 forks source link

Google Analytics #596

Closed karimkawambwa closed 5 years ago

karimkawambwa commented 5 years ago

Description

Initial Track different page usages.

Fixes # (issue)

Type of change

Please delete options that are not relevant.

Screenshots

Screen Shot 2019-06-24 at 3 05 19 PM

Checklist:

kilemensi commented 5 years ago

PS: I think we also need to track actions on Data by Topic side of things in charts.js

karimkawambwa commented 5 years ago

PS: I think we also need to track actions on Data by Topic side of things in charts.js

I knew i was forgetting something

PS: It is sugested that the actions be unique eventAction

cc @kilemensi

karimkawambwa commented 5 years ago

PS: It is sugested that the actions be unique eventAction

@kilemensi let me expand on that

if a user clicks download on two different indicators but you use same action name ‘Download’, then in that case Google Analytics will report only one unique event

kilemensi commented 5 years ago

PS: It is sugested that the actions be unique eventAction

This is one of the examples in the documentation @karimkawambwa:

ga('send', {
  hitType: 'event',
  eventCategory: 'Videos',
  eventAction: 'play',
  eventLabel: 'Fall Campaign'
});

play can not be unique there. I think eventLabel is what makes it unique in this case & in our case, we're using unique eventLabels as well.

karimkawambwa commented 5 years ago

PS: It is sugested that the actions be unique eventAction

This is one of the examples in the documentation @karimkawambwa:

ga('send', {
  hitType: 'event',
  eventCategory: 'Videos',
  eventAction: 'play',
  eventLabel: 'Fall Campaign'
});

play can not be unique there. I think eventLabel is what makes it unique in this case.

Hmm... Lets implement your suggestions and edit as we go

karimkawambwa commented 5 years ago

@kilemensi this is ready, I think the video tracking should go in a separate PR because tracking the youtube click will need api. I was looking into ?enablejsapi=1 if its not deprecated we could use that in the iframe and get a state change when play is clicked then send google analytics.But youtube has its play count so we could still tell if people are playing it or not.

kilemensi commented 5 years ago

@kilemensi this is ready, I think the video tracking should go in a separate PR because tracking the youtube click will need api. I was looking into ?enablejsapi=1 if its not deprecated we could use that in the iframe and get a state change when play is clicked then send google analytics.But youtube has its play count so we could still tell if people are playing it or not.

My thinking ìs enablejapi=1 is still supported, have you heard anything to the contrary @karimkawambwa ? Because then tracking play becomes a simple matter of creating the player scriptand attaching events: https://developers.google.com/youtube/iframe_api_reference#Examples

karimkawambwa commented 5 years ago
Screen Shot 2019-06-25 at 1 16 54 PM Screen Shot 2019-06-25 at 1 15 47 PM Screen Shot 2019-06-25 at 1 15 37 PM Screen Shot 2019-06-25 at 1 13 12 PM

cc @kilemensi tested