Download & Extend

New Google Analytics Tracking

Project:Google Analytics
Version:5.x-1.x-dev
Component:Code
Category:feature request
Priority:critical
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

GA has a new tracking system and will slowly do away with urchin.

This patch allows for legacy GA but defaults to the most recent GA script.

AttachmentSizeStatusTest resultOperations
updated_google_analytics.patch2.73 KBIgnored: Check issue status.NoneNone

Comments

#1

Status:needs review» needs work

How does the segmentation and codesnippet stuff work with this new patch? It looks like you've not supported it in the new version?

#2

I've worked up some code based on the new Beta, it's in CVS now. However i've not had a chance to check it works - specifically with user segmentation and/or code snippets.

Please try and post here any problems.

#3

Status:needs work» fixed

#4

Google has published a pdf guide to migrate from urchin.js to ga.js: http://www.google.com/analytics/GATCmigrationguide.pdf, a Guide to install the new tracking code: http://www.google.com/analytics/InstallingGATrackingCode.pdf and a analytics developer site: http://code.google.com/apis/analytics/

Hope this help

#5

Sorry budda, still getting used to submitting patches. I did a patch from what I had installed locally rather then what you had in cvs.

Thanks for updating.

#6

Priority:normal» critical
Status:fixed» needs work

1. The committed patch break the download tracker. Aside the noscript tags should be removed!

+      $script = '<script type="text/javascript" src="http' . $prefix . ".google-analytics.com/urchin.js\"></script>\n";
+      $script .= '<script type="text/javascript">' . "<!--\n_uacct = \"".$id."\";{$segmentation}{$codesnippet}urchinTracker();\n// --></script><noscript></noscript>\n";

2. and why are you adding <!-- ... --> to the second line?

3. Code Style is an issue here.

4. SSL example from the docs

<script type="text/javascript">
  var gaJsHost = (("https:" == document.location.protocol) ?
  "https://ssl." : "http://www.");
  document.write(unescape("%3Cscript src='" + gaJsHost +
  "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
  var pageTracker = _gat._getTracker("UA-12345-1");
  pageTracker._initData();
  pageTracker._trackPageview();
</script>

5. local cached copy is not implemented

6. googleanalytics_cron() downloads the wrong file to cache

7. Text constants need to be altered to reflect ga.js.

#7

#1 and #2 have some open questions.

D6: See http://drupal.org/cvs?commit=93222 where i fixed most of the above bugs.

#8

#9

Hey hass,

I want to make sure that my coding standards continue to improve. I'm reviewing my patch from your 7 comments listed above.

1. the comment out codes were in the module I was originally working on. I think my original patch shows that.

2. same as #1 I believe

3. refers to #2 & #4

4. My patch code looks nearly identical to what you have listed

5. Local cache copy? does this refer to #6.

6. googleanalytics_cron -> that function doesn't exist in the version I was working with.

7. I thought my submitted patch did reflect the ga.js
document.write("\<script src=\'" + gaJsHost + "google-analytics.com/ga.js\' type=\'text/javascript\'>\<\/script>" );

So my question is.... did your list really apply to my patch or something else. As you can tell I'm somewhat confused.

Thanks!

#10

Your patch above was outdated when it was comitted and has been reroled with bugs.

I think budda added your changes, but re-introduced bugs (for e.g. #1: noscript tags) fixed earlier but after you created your patch... that's the main problem i think. Now it's more a follow up to fix bugs introduced by this committ and to add some missing/incomplete parts.

#11

Thanks for clarifying that. I was really thrown off by not using the most current version.

Since the code has been committed, should this thread still be status: code needs work?

#12

yes, the committed patch is buggy, so needs work.

#13

subscribing

#14

Suscribing.

#15

subscribing.

#16

Will the new GA code be able to be cached by this module, like the legacy urchin code can be?

#17

Yes. D6 already caches both, D5 need to be fixed.

#18

Cache now downloads the old or new GA file depending on the legacy setting.
Cron now clears the right file.

#19

Status:needs work» fixed

All from #6 should be fixed now.

#20

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

nobody click here