On September 18, 2012 , there was a new release of Google Analytics API, with 40+ new data points. The new dimensions and metrics are listed here. The google_analytics_views module should be updated to display the new dimensions and metrics as fields.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Anonymous’s picture

mikeprinsloo’s picture

Status: Active » Needs review
FileSize
11.17 KB

A couple of single quotes weren't escaped properly.

BrightBold’s picture

Status: Needs review » Active

Thank for this!

Don't you need to escape the apostrophes in "user's" for the descriptions of ga:socialActivityUserPhotoUrl and ga:socialActivityUserProfileUrl?

twardnw’s picture

getting LOTS of whitespace errors from patch in #2

Anonymous’s picture

Category: feature » support
Status: Active » Reviewed & tested by the community

I see the errors too. I suspect that the patch author used some PHP scripting to generate the code from another source.. perhaps the API reference guide? There are blank spaces after the array operator => which is something I recognize from var_dump().

Regardless, the patch can be applied without error. And I'm using it with success.

midlake’s picture

Wait... what? Does the latest release of the module contain the patch, or do we need to apply it ourselves? And if so, how?

MrPaulDriver’s picture

It would be good if the patch could be committed to dev. It's been a while now

anniegreens’s picture

Cleaned up patch from #2 attached.

pinkonomy’s picture

Is this patch on the dev version?If not,which module should I apply this?

nickdb93’s picture

Issue summary: View changes

Can we get pinkonomy's question answered for the annuls of Google?

BrightBold’s picture

Patches should always be for the dev version.

To answer midlake's question, this page on how to apply a patch on Windows offers a great introduction, which you can modify (and which will actually be much easier) if you're on Mac.

JadH’s picture

Patch from #8 is returning the below

patching file google_analytics_views.module
patch unexpectedly ends in middle of line
Hunk #2 succeeded at 1451 with fuzz 1.
Plazik’s picture

Title: Update google_analytics_views module with the new datapoints from the Google Analytics API Release 2012-09 » Update google_analytics_views module with the new datapoints and delete deprecated
Status: Reviewed & tested by the community » Needs work

The patch from #8 is incomplete. There are a lot of changes in datapoints since the time when patch was posted.
See:

There is a new category "Calculated Metrics" in addition to "Dimensions" and "Metrics". Some datapoints are deprecated.

JadH’s picture

I am working on this file with all the updates including the label and the description of each datapoint.

I will share it by next week.

Plazik’s picture

Title: Update google_analytics_views module with the new datapoints and delete deprecated » Update google_analytics_views module with the new datapoints
Parent issue: » #2357771: META: Plan for Google Analytics Reports 7.x-3.0-beta1 release

I think we should keep deprecated datapoins to prevent problems with update from dev version.

JadH’s picture

I had them removed, but I will reinsert them in this case.

JadH’s picture

Palzik, would it be worth adding a Status to each datapoint? in order to know which one was deprecated or not? and maybe add the replaced by also?
What do you think?

Plazik’s picture

@JadH, yes, I think we have to add Status and the replaced by but only for deprecated datapoints.

Plazik’s picture

Assigned: » Unassigned
Category: Support request » Feature request
Plazik’s picture

@JadH, it has been more than week since comment #14 so I've started to write the patch by myself.

JadH’s picture

@Plazik, I am really sorry, got stuck at work.
I will email you what I have done so far.

All is included, what remains is the below:
1- Doubleclick
2- Reinsert Deprecated datapoints

-- UPDATE --
I emailed it to you on your gmail, check your spam if you don't see it

Plazik’s picture

@JadH thanks, I got it.

But I've finished my patch too (with all datapoins: Doubleclick and deprecated). It needs some test. I'll post it in a few days.

Plazik’s picture

  • Added all new datapoints.
  • Added support for translation name, group and description.
  • Added calculation key to datapoints array with calculation formula.
  • Fixed code style.

Datapoints with custom (n) number (goal(n)Value, ga:customVarName(n), etc) replaced with XX number (ga:goalXXValue, ga:customVarNameXX) so we also need a update pach.

JadH’s picture

@Plazik, regarding the the Datapoints with custom (n) number (goal(n)Value, ga:customVarName(n), etc) replaced with XX number (ga:goalXXValue, ga:customVarNameXX) so we also need a update pach, I already did them and they are in the file I have sent.

Due to this change, I suggest that the custom reports in the module should be change, visits should be replaced by sessions and visitors with users.

Plazik’s picture

@JadH, I mean update patch with hook_update_N, where all datapoins with (n) will be converted into datapoints with XX in existing views.

Due to this change, I suggest that the custom reports in the module should be change, visits should be replaced by sessions and visitors with users.

We should open another issue to this.

Plazik’s picture

Status: Needs work » Needs review
FileSize
178.17 KB

Patch from #23 with addition features:

  • Added update function, which contert old datapoins with (n) in name into datapoins with XX.
  • Removed all deprecated datapoins.
  • Added update function, which replce deprecated datapoins with new ones. ga:ROI, ga:margin, ga:isMobile, ga:isTablet don't have new equivalents.
  • Fixed custom fileds.
  • Moved datapoins api names (ga:blablabla) into filed description.

Don't forget to clear the cache and run update.php!

Plazik’s picture

Small changes:
Old:

  foreach ($fields as $field_name => $field) {
    $field['description'] = $field['description'] . '<br />' . t('API name:') . ' ga:&#039; . $field_name . &#039;.';
    if (isset($field['calculation'])) {
      $field['description'] = $field['description'] . '<br />' . t('Calculation') . ': &#039; . $field[&#039;calculation&#039;] . &#039;';
    }

New:

  foreach ($fields as $field_name => $field) {
    if (isset($field['calculation'])) {
      $field['description'] = $field['description'] . '<br />' . t('Calculation: @formula.', array('@formula' => $field['calculation']));
    }
    $field['description'] = $field['description'] . '<br />' . t('API name: @ga.', array('@ga' => 'ga:' . $field_name));
Plazik’s picture

  • Plazik committed 304d9fb on 7.x-3.x
    Issue #1796034 by Plazik, anniegreens, mikeprinsloo, gpapadongonas:...
Plazik’s picture

Status: Needs review » Fixed
Plazik’s picture

The next step is removing all datapoins from code and grabbing it from Google server https://www.googleapis.com/analytics/v3/metadata/ga/columns?pp=1.

See #2373151: Support Google Analytics Metadata API.

Status: Fixed » Closed (fixed)

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