Extension: Google Analytics

Discuss PivotX 2.0.x extensions here, and view extensions that are available for download.

Re: Extension: Google Analytics

Postby hansfn » Tue Aug 16, 2011 1:55 pm

Oh, I see what is going on. The extension isn't HTML5 safe ;-) The hook tries to insert the GA code right before the end of the head element. Unfortunately, the regular expression matches "</head". Your template contains the HTML5 header element whose end tag also matches "</head". I think the fix is very easy:

In hook_googleanalytics.php (around line 140) replace

Code: Select all
$html = preg_replace('#</head#si', $output."</head", $html);

with

Code: Select all
$html = preg_replace('#</head#si', $output."</head", $html, 1);

Let me know if that worked.
hansfn
Developer
 
Posts: 3072
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: Extension: Google Analytics

Postby localhost » Tue Aug 16, 2011 2:19 pm

Thanks Hans. That worked (for me).
--People who say it cannot be done, should not interrupt those who are doing it.--
User avatar
localhost
 
Posts: 57
Joined: Fri Jan 25, 2008 8:23 am
Location: NL

Re: Extension: Google Analytics

Postby hansfn » Sun Jan 01, 2012 5:58 pm

Just released version 0.7.1 which fixes a typo - 'Web Property ID' was wrongly written as 'Web Propery ID' - and the problem with the header element in HTML5 (reported above).

PS! If you are happily using version 0.7 there is no need to upgrade.
hansfn
Developer
 
Posts: 3072
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: Extension: Google Analytics

Postby Logfather » Thu Aug 16, 2012 8:28 am

Hey Hans! Is it possible that when you enable two-step authentication on your Google account (this involves receiving a pincode on your mobile phone when you want to get into your account) it blocks out the Google Analytics plugin?

So far I don't think it has interfered with statistics but I noticed the diagram on my admin panel has stopped. ;)
Logfather
 
Posts: 150
Joined: Sun Jul 12, 2009 9:29 am
Location: Amsterdam

Re: Extension: Google Analytics

Postby hansfn » Fri Aug 17, 2012 7:07 am

You need to get a application-specific password from Google.
hansfn
Developer
 
Posts: 3072
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: Extension: Google Analytics

Postby Logfather » Fri Aug 17, 2012 9:13 am

I see and just paste that in the Google account password in the extensions' settings?
Logfather
 
Posts: 150
Joined: Sun Jul 12, 2009 9:29 am
Location: Amsterdam

Re: Extension: Google Analytics

Postby hansfn » Fri Aug 17, 2012 10:04 am

Yes.
hansfn
Developer
 
Posts: 3072
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: Extension: Google Analytics

Postby Logfather » Fri Aug 17, 2012 6:45 pm

Thank you Hans! This should be mentioned in the plugin no?

Code: Select all
Are you using two-factor authentication on your Google account? Generate an application-specific password and use this (without spaces) instead of your normal Google account password.
Logfather
 
Posts: 150
Joined: Sun Jul 12, 2009 9:29 am
Location: Amsterdam

Re: Extension: Google Analytics

Postby loriswave » Fri Oct 05, 2012 3:10 pm

Hi,
i have install and set but when click for test recive this error

"Testing Google Analytics Login

logged in successfully!

Warning: Unknown error when accessing the Google Analytics API, HTTP STATUS 404 in /membri/loriswave/pivotx/extensions/googleanalytics/analytics_api.php on line 118

No accounts found."

some one can help me
loriswave
 
Posts: 8
Joined: Mon Aug 31, 2009 1:04 pm

Previous

Return to 2.x Extensions

Who is online

Users browsing this forum: No registered users and 1 guest

cron