Closed Bug 831618 Opened 11 years ago Closed 11 years ago

[Google Analytics] Track Article Reads in Google Analytics

Categories

(support.mozilla.org :: Knowledge Base Software, task, P2)

Tracking

(Not tracked)

VERIFIED FIXED
2013Q1

People

(Reporter: ibai, Assigned: rrosario)

References

Details

(Whiteboard: u=sumo-team c=analytics p=2 s=2013.2)

One of the things that we don't have good visibility and it will allow us to have better understanding of how users interact with our site is to understand how many people actually read articles (i.e. not only open the KB article but actually spend some time on it)

My proposal to work around this is to create an GA Event that captures how many people spends more than a fixed amount of time in KB articles. I think that we could start low, something like 10 seconds to ensure that even short articles are captured here. By using Events we preserve the information that we learn from pageviews but we create a new layer of information.

The implementation will require to add the following like to the Analytics code when the page that we are showing is a KB article (not a navigation page or a forum page):

setTimeout("_gaq.push(['_trackEvent', 'Article_Read', $article_slug])",10000);

*Again, sorry for my PHP notation

This line needs to be just after the following one:
_gaq.push(['_trackPageview']);

For more information on Event Tracking: https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide

Let me know if you need more info.
Blocks: 830753
We already track reads on kb articles (time on page) and have been for over a year. We just need to parse the logs to get the data. I think Cheng has already done this in the past so he might have the script you can use.

I agree that it would be great to remove our custom read tracking code and use Google Analytics. But the analysis you want to do isn't blocked by this bug because we already have the data elsewhere.

CC:ing Cww
I'm familiar with that datasource and I agree that doesn't necessarily block the other one. If we decide to use the logs, then we need to use Waffle to do the A/B analysis.

So it's more a question of either spending time in setting up the A/B and performing the manual analysis crossing data from GA and the logs or spend some time adding this line to the code.

In any case, this bug is not only for this particular A/B. It will facilitate many other analysis.
Priority: -- → P2
Whiteboard: u=sumo-team c=analytics p=2 s=2013.2
Target Milestone: --- → 2013Q1
Assignee: nobody → rrosario
(In reply to ibai from comment #0)
> setTimeout("_gaq.push(['_trackEvent', 'Article_Read',
> $article_slug])",10000);

I'm going to change the parameters to look more like the ShowFor tracking ():

     _trackEvent('Article Read', 'download-and-install-firefox-android / en-US')
     _trackEvent('Article Read', 'update-firefox-latest-version / pt-BR')


Let me know if this isn't OK.
(In reply to Ricky Rosario [:rrosario, :r1cky] from comment #3)
> ShowFor tracking ()

I meant to link to Bug 826804
Or I could do:

    _trackEvent('Article Read', '10secs', 'download-and-install-firefox-android / en-US')

So that later one we could add more levels?
I think that we should implement the Read as one defined value and modify it later if needed. Having multiple levels times on page is already implemented in GA so I don't think that it adds much value.

What we are trying to achieve here is to have a more specific timing for a specific set of pages (articles).

So my vote is to keep it simple.
(In reply to ibai from comment #6)
> So my vote is to keep it simple.

Awesome, that's what I have in the pull request:

https://github.com/mozilla/kitsune/pull/1093
Deployed to prod and i see the request to GA after ~10 seconds.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Data is being collected as from January 30th.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.