I had previously had this module working correctly but now I have the following error appearing with both the API config and also the reports. In addition the views are no longer present.

Any pointers would be most welcome.

Undefined property: stdClass::$defaultPage in google_analytics_api_admin() (line 55 of /sites/all/modules/google_analytics_reports/google_analytics_api.pages.inc).

Comments

SocialNicheGuru’s picture

I can confirm this too

deanflory’s picture

I too am getting:

Notice: Undefined property: stdClass::$defaultPage in google_analytics_api_admin() (line 55 of /.../sites/all/modules/google_analytics_reports/google_analytics_api.pages.inc).

mmenavas’s picture

On google_analytics_api.pages.inc, line 55, it is assumed the optional 'Default Page' setting has a value (to edit this setting go to google.com/analytics, click on Admin, select account, select property, select profile, and click on the Profile Settings tab).

Perhaps the existence of $current_profile->defaultPage should be checked before being used in variable_set.

benchesters’s picture

Hi, I don't understand what you mean by this. You are saying alter which setting within GA?

deanflory’s picture

Total guesss: maybe they're saying you should just go to that GA Profile Settings tab and just save it, so it creates a value.

millionleaves’s picture

Not sure it makes sense to check for a default page.

The default page value in GA is for sites that have an "index.php" page which can be accessed separately from the root of the site (and, potentially, index and tracked as a separate page).

On all of my sites, the home page identified in Site Configuration is always 301 redirected to /, so it seems unnecessary to provide a default page in the GA profile settings.

chertzog’s picture

This does a check for the default page and if not found, sets it to "/".

<?php
   
/* Load current profile object */
   
foreach ($profiles as $profile) {
      if (
$profile->id == $profile_id) {
       
$current_profile = $profile;
       
$page = isset($current_profile->defaultPage) ? $current_profile->defaultPage : '/';
       
variable_set('google_analytics_reports_default_page', $page);
        break;
      }
    }
?>
kingfisher64’s picture

Can confirm this is still popping up using the latest dev versions of the module from September 30.

Any suggestions?

kingfisher64’s picture

Issue summary:View changes

typo

cblanglois’s picture

Has this been resolved, i'm currently facing the same issue.

kevinsullivan’s picture

I'm also seeing it on my site.

kingfisher64’s picture

To the current maintainer, can you please suggest how to fix this. It's been 3 months since my last request and others are getting this as well.

Many thanks for your time.

twatters963’s picture

I have the same problem as well. Any help would be very appreciated!

hadsie’s picture

Issue summary:View changes
StatusFileSize
new661 bytes

Here's a patch that does pretty much what was suggested in #7

manyk’s picture

Even more ... the line 55 could be turned into this

<?php
variable_set
('google_analytics_reports_default_page', isset($current_profile->defaultPage) ? '/' . $current_profile->defaultPage : '/');
?>
manyk’s picture

Category:Support request» Bug report
Status:Active» Needs review
JadH’s picture

Applying patch from 13 fixes the issue

Plazik’s picture

Patch from #13 and #14.

  • Plazik committed 76cc624 on 7.x-3.x authored by hadsie
    Issue #1984506 by Plazik, hadsie | MrPaulDriver: Fixed Undefined...
Plazik’s picture

Status:Needs review» Fixed
Plazik’s picture

Status:Fixed» Closed (fixed)

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