Closed
Bug 839248
Opened 13 years ago
Closed 13 years ago
[Google Analytics] Unify article slug in the tracking system
Categories
(support.mozilla.org :: Knowledge Base Software, task, P3)
support.mozilla.org
Knowledge Base Software
Tracking
(Not tracked)
RESOLVED
FIXED
2013Q1
People
(Reporter: ibai, Assigned: rrosario)
Details
(Whiteboard: u=sumo-team c=general p=1 s=2013.5)
For tracking purposes, it would be great if we could pass Google Analytics the English slug instead of the localized one. This would allow us to compare apples to apples when we are looking into articles and it will help aggregate data from different locales easily.
I've been investigating if it's possible to modify the URL that we send to Google Analytics and there seem to be a possibility.
The JS snippet generates a GIF request that contains all the information that GA then uses to record the pageview. The trick is to modify this GIF before it's sent to the Google servers.
I found relevant information about how to generate GIF request without the JS snippet but not much about how to modify one.
From conversations with Kadir and Ricky, it seems that we all agree that this change would be great, but in the other hand I'm not sure if we should do it if it's really cumbersome or messy.
Some documentation that I found:
How to generate the GIF request in Python (not the same usecase but helps as a reference):
http://www.canb.net/2012/01/push-data-to-google-analytics-with.html
Structure of the GIF:
https://developers.google.com/analytics/resources/articles/gaTrackingTroubleshooting#gifParameters
We would need to capture this and modify the utmp.
Comment 1•13 years ago
|
||
Ricky, can you look into the implications of this? How messy would it get, especially considering putting the GA script into the <head>.
Whiteboard: u=sumo-team c=general p= s=2013.4
Updated•13 years ago
|
Priority: -- → P3
Target Milestone: --- → 2013Q1
Comment 2•13 years ago
|
||
I think we need details from r1cky before we can work on this. I vote we push it off until the next sprint.
Comment 3•13 years ago
|
||
Failing to next sprint, at least until we have an estimate from Ricky.
Whiteboard: u=sumo-team c=general p= s=2013.4 → u=sumo-team c=general p= s=2013.5
| Assignee | ||
Comment 4•13 years ago
|
||
This is an interesting idea. It seems like it might be messy since you are trying to change GA's normal behavior. It requires some research.
Would we be able to accomplish the same end by adding a custom variable on article pages? We could send the document_id of the english document, for example. A nice thing about this is that changing slugs won't screw up the data.
Comment 5•13 years ago
|
||
It should be fairly simple to change the url that GA tracks. Currently in the file analytics.js we have:
_gaq.push(['_trackPageview']);
This is GA's way of calling the function _trackPageview. _trackPageview takes one optional parameter: the url to track. This feature is documented here[0]. We could change this line to something like
var url = $('body').data('ga-alternate-url');
if (url) {
_gaq.push(['_trackPageview', url]);
} else {
_gaq.push(['_trackPageview']);
}
Maybe there is a more elegant way to do it, but it gets the job done (assuming the backend knows how to fill in that data element properly).
[0]: https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiBasicConfiguration#_gat.GA_Tracker_._trackPageview
| Assignee | ||
Comment 6•13 years ago
|
||
(In reply to Mike Cooper [:mythmon] from comment #5)
> It should be fairly simple to change the url that GA tracks.
That's awesome, thanks! Making this a 1ptr.
Whiteboard: u=sumo-team c=general p= s=2013.5 → u=sumo-team c=general p=1 s=2013.5
| Reporter | ||
Comment 7•13 years ago
|
||
That's super cool.
Thanks Mike for figuring out. I spent a good amount of time trying to find something like that with no luck...This solution seems fairly straight forward. Let me know when you are ready to push this life and I can track that it works fine.
| Assignee | ||
Updated•13 years ago
|
Assignee: nobody → rrosario
| Assignee | ||
Comment 8•13 years ago
|
||
In a pull request:
https://github.com/mozilla/kitsune/pull/1191
| Assignee | ||
Comment 9•13 years ago
|
||
| Assignee | ||
Comment 10•13 years ago
|
||
This was deployed to prod.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•