Extension: Google Analytics

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

Re: Extension: Google Analytics

Postby krebra » Tue Mar 30, 2010 3:36 pm

hansfn wrote:The extension and the PivotX core isn't in sync - I guess. Grab PivotX Latest from http://pivotx.net/files/unstable-development/

thanks for the answer.
hmmm, is this version safe, since it is under development? my web-pages are in production.
krebra
 
Posts: 10
Joined: Tue Feb 02, 2010 4:38 pm

Re: Extension: Google Analytics

Postby hansfn » Tue Mar 30, 2010 4:27 pm

Version 2.0.2 is just a snapshot of the development towards 2.1.0 and has it's bugs. The unstable branch has many of those bugs fixed, and several new features, but also probably some new bugs. IMHO the best choice is still the unstable version (until we release 2.1.0).
hansfn
Developer
 
Posts: 3282
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: Extension: Google Analytics

Postby krebra » Tue Mar 30, 2010 5:36 pm

I gave a bet. So far so good. :) Thanks.
krebra
 
Posts: 10
Joined: Tue Feb 02, 2010 4:38 pm

Re: Extension: Google Analytics

Postby localhost » Fri Jul 02, 2010 12:39 pm

I've got another question. The stats show up in my dashboard, but it lacks all styling. To make it clear, look at the image ;-)
Image
My guess is this has something to do with not being able to load the googleanalytics.js and googleanaytics.css. Not sure if that's the problem. If I call those files in the browser I get a nice error:
Code: Select all
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access /pivotx/extensions/googleanalytics/googleanalytics.js
on this server.</p>
<p>Additionally, a 404 Not Found
error was encountered while trying to use an ErrorDocument to handle the request.</p>
</body></html>

Also, the file access on all files in the /pivotx/extensions/googleanalytics/ are the same and I do get to see stats:
Code: Select all
-rw-r--r-- 1

I compared this to the syntaxhighlighter and it seems to be wrong. So I changed it to match the file rights by doing a chmod 755 *. Unfortunately that doesn't help.

For now I've made a rather ugly change by copying the .js and .css to the [templates_dir]/googleanalytics and changing line 561 of hook_googleanalytics.php:
Code: Select all
$path = $PIVOTX['paths']['extensions_url'];

to
Code: Select all
$path = $PIVOTX['paths']['templates_url'];


Does anyone have an idea on what I'm doing wrong here?
--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 localhost » Fri Jul 02, 2010 1:02 pm

Never mind. It's always good to try to find as many information as possible when asking around. Found the problem.

Not only where the file permission inside the folder incorrect, they where wrong on the folder itself too.
Doing a "chmod 755 googleanalytics" made it all work.
--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 Wim » Thu Oct 07, 2010 9:30 pm

I am working on an update for the Google Analytics extension to use the asynchronous tracking code. This will allow to load the ga.js code in the background while the browser continues to render the page. In effect this will eliminate rendering delays even if there is a problem with getting or executing the tracking code.

The basic functionality remains the same. The asynchronous tracking code will however be added to the head section of the page, no longer near the end of the body section.

While I have this working on my own website, I would like some feedback from other testers. So if you are using version 0.5 of the Google Analytics extension, and you are willing to contribute to this test, I would appreciate if you could provide some feedback. To install the updated script, please copy the hook_googleanalytics.php file from the attached zip archive into your webserver's pivotx/extensions/googleanalytics folder (overwriting the existing file with the same name).

Many thanks in advance!

(update: removed the attachment. Latest version of the Google Analytics extension is now available here.)
Last edited by Wim on Tue Jul 19, 2011 5:13 pm, edited 1 time in total.
User avatar
Wim
 
Posts: 59
Joined: Sun Dec 28, 2008 11:32 am

Re: Extension: Google Analytics

Postby Logfather » Wed Nov 03, 2010 10:13 am

Not sure why or how this is a problem but I switched from PivotX 2.1.1 to 2.1.2 yesterday and my Analytics recorded 0 unique visitors. Bit weird since I get several hundred visitors a day on a "regular" day. Minor hiccup? I hope so...
Logfather
 
Posts: 163
Joined: Sun Jul 12, 2009 9:29 am
Location: Amsterdam

Re: Extension: Google Analytics

Postby Wim » Wed Nov 03, 2010 6:27 pm

Logfather wrote:Not sure why or how this is a problem but I switched from PivotX 2.1.1 to 2.1.2 yesterday and my Analytics recorded 0 unique visitors. Bit weird since I get several hundred visitors a day on a "regular" day. Minor hiccup? I hope so...


I was able to compare your website's html source from before the upgrade (through Google cache) and after. I see no difference in the google analytics code added by the extension before and after. So this can't be the problem. What else?

BTW, you can do some things to verify your Google Analytics setup, see this article.
User avatar
Wim
 
Posts: 59
Joined: Sun Dec 28, 2008 11:32 am

Re: Extension: Google Analytics

Postby DiMTRX » Sat Nov 06, 2010 3:02 pm

A little note,

Could you perhaps in the next version change the naming in accordance to the other google extentions/widgets.
So instead of googleanalytics it would become Google Analytics like Google Calendar, Google Maps etc?

*Edit*

After I had to reinstall pivotx and this extention I went digging through the code and found the line you need to modify.

Change line 147
Code: Select all
$this->addHook(
    'configuration_add',
    'googleanalytics',
    array("googleanalyticsAdmin", "googleanalytics")
);

into
Code: Select all
$this->addHook(
    'configuration_add',
    'googleanalytics',
    array("googleanalyticsAdmin", "Google Analytics")
);


I just hope it doesn't break anything else hehe
User avatar
DiMTRX
 
Posts: 8
Joined: Tue Aug 18, 2009 4:57 pm
Location: Netherlands

Re: Extension: Google Analytics

Postby localhost » Tue Aug 16, 2011 12:36 pm

Not sure if this topic is still active, but I've got an issue with the extension.

I recently updated the extension and today I updated to PivotX 2.3.0. While checking if all was working fine, I noticed the Google Analytics code shows up twice on my site. Once directly after the title and once at the end of my <header> section.
Header template
Code: Select all
<!DOCTYPE html>
<!--[if lt IE 7 ]> <html class="ie6"> <![endif]-->
<!--[if IE 7 ]>    <html class="ie7"> <![endif]-->
<!--[if IE 8 ]>    <html class="ie8"> <![endif]-->
<!--[if IE 9 ]>    <html class="ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html class=""> <!--<![endif]-->
<head>
  <meta charset="utf-8" />
  <link rel="stylesheet" type="text/css" href="[[template_dir]]styles/reset.css"/>
  <link href="[[template_dir base="true" ]]pivotx_essentials.css" rel="stylesheet" type="text/css" media="screen" /> 
  <link rel="stylesheet" type="text/css" href="[[template_dir]]styles/main.css"/>
  <!--[if lt IE 9]>
  <!-- Wake up HTML5 elements for older IE versions -->
  <script async src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  <![endif]-->
  <script async type="text/javascript" src="[[template_dir]]scripts/scripts.js"></script>
  <title>
    [[ if $pagetype=="entry" || $pagetype=="page" ]][[title strip=1]] - [[sitename]]
    [[ else ]][[sitename]][[/if]]
  </title>
</head>
<body>
<div id="wrapper">
<header>
  <hgroup>
    <h1><a href="[[home]]">[[weblogtitle]]</a></h1>
    <h2>[[weblogsubtitle]]</h2>
  </hgroup>
<nav>
[[ pagelist
chapterbegin="<ul>"
pages="<li %active%><a href='%link%' title='%subtitle%'>%title%</a></li>"
chapterend="</ul>"
isactive="class='page_item current_page_item'"
]]
</nav>
<div class="clear">&nbsp;</div>
</header>
<div id="content">

Rendered source
Code: Select all
<!DOCTYPE html>
<!--[if lt IE 7 ]> <html class="ie6"> <![endif]-->
<!--[if IE 7 ]>    <html class="ie7"> <![endif]-->
<!--[if IE 8 ]>    <html class="ie8"> <![endif]-->
<!--[if IE 9 ]>    <html class="ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html class=""> <!--<![endif]-->
<head>
     <script type="text/javascript" src="/pivotx/includes/js/jquery-1.6.2.min.js">jQuery.noConflict();</script>
<meta charset="utf-8" />
  <link rel="stylesheet" type="text/css" href="/pivotx/templates/callmelocalhost-v3/styles/reset.css"/>
  <link href="/pivotx/templates/pivotx_essentials.css" rel="stylesheet" type="text/css" media="screen" /> 
  <link rel="stylesheet" type="text/css" href="/pivotx/templates/callmelocalhost-v3/styles/main.css"/>

  <!--[if lt IE 9]>
  <!-- Wake up HTML5 elements for older IE versions -->
  <script async src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  <![endif]-->
  <script async type="text/javascript" src="/pivotx/templates/callmelocalhost-v3/scripts/scripts.js"></script>
  <title>
    127.0.0.1  </title>
<!-- Start of Google Analytics Code - Google Analytics extension for PivotX -->
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-262414-1']);
  _gaq.push(['_setDomainName', '.callmelocalhost.com']);
_gaq.push(['_setAllowHash', false]);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>
<!-- End of Google Analytics Code - Google Analytics extension version 0.7 -->
<script type="text/javascript" src="/pivotx/extensions/syntaxhighlighter/scripts/shCore.js"></script>
<script type="text/javascript" src="/pivotx/extensions/syntaxhighlighter/scripts/shBrushBash.js"></script>
<script type="text/javascript" src="/pivotx/extensions/syntaxhighlighter/scripts/shBrushCss.js"></script>

<script type="text/javascript" src="/pivotx/extensions/syntaxhighlighter/scripts/shBrushJScript.js"></script>
<script type="text/javascript" src="/pivotx/extensions/syntaxhighlighter/scripts/shBrushPhp.js"></script>
<script type="text/javascript" src="/pivotx/extensions/syntaxhighlighter/scripts/shBrushPlain.js"></script>
<script type="text/javascript" src="/pivotx/extensions/syntaxhighlighter/scripts/shBrushPython.js"></script>
<script type="text/javascript" src="/pivotx/extensions/syntaxhighlighter/scripts/shBrushSql.js"></script>
<script type="text/javascript" src="/pivotx/extensions/syntaxhighlighter/scripts/shBrushXml.js"></script>
<link type="text/css" rel="stylesheet" href="/pivotx/extensions/syntaxhighlighter/styles/shCore.css"/>
<link type="text/css" rel="stylesheet" href="/pivotx/extensions/syntaxhighlighter/styles/shThemeDefault.css"/>
<script type="text/javascript">
        SyntaxHighlighter.config.clipboardSwf = "/pivotx/extensions/syntaxhighlighter/scripts/clipboard.swf";
        SyntaxHighlighter.all();
</script>

   <meta name="generator" content="PivotX" /><!-- version: PivotX - 2.3.0 -->
   <link rel="shortcut icon" href="http://callmelocalhost.com/favicon.ico" />

   <link rel="canonical" href="http://callmelocalhost.com/" />

   <link rel="alternate" type="application/rss+xml" title="127.0.0.1 &raquo; 127.0.0.1 (RSS feed)" href="http://callmelocalhost.com/rss" />
   <link rel="alternate" type="application/atom+xml" title="127.0.0.1 &raquo; 127.0.0.1 (Atom feed)" href="http://callmelocalhost.com/atom" />
   <link rel="alternate" type="application/rss+xml" title="127.0.0.1 &raquo; 127.0.0.1 (RSS feed voor reacties)" href="http://callmelocalhost.com/rss/comments" />
   <link rel="alternate" type="application/atom+xml" title="127.0.0.1 &raquo; 127.0.0.1 (Atom feed voor reacties)" href="http://callmelocalhost.com/atom/comments" />

   <link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://callmelocalhost.com/index.php?x=rsd" />

</head>
<body>
<div id="wrapper">
<header>
  <hgroup>
    <h1><a href="/">127.0.0.1</a></h1>
    <h2>But you can call me localhost</h2>
  </hgroup>

<nav>
<ul><li ><a href='/page/e-127001' title='But you can call me localhost'>127.0.0.1?</a></li>
<li ><a href='/page/over' title=''>Over mij</a></li>
<li ><a href='/page/portfolio' title=''>Portfolio</a></li>
<li ><a href='/page/ook-interessant' title=''>Ook interessant</a></li>
<li ><a href='/page/mobile-apps' title=''>Mobile Apps</a></li></ul>
</nav>
<div class="clear">&nbsp;</div>
<!-- Start of Google Analytics Code - Google Analytics extension for PivotX -->
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-262414-1']);
  _gaq.push(['_setDomainName', '.callmelocalhost.com']);
_gaq.push(['_setAllowHash', false]);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>
<!-- End of Google Analytics Code - Google Analytics extension version 0.7 -->

</header>


Not sure what I'm doing wrong here :(
--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

PreviousNext

Return to 2.x Extensions

Who is online

Users browsing this forum: No registered users and 3 guests

cron