Loading ...
Sorry, an error occurred while loading the content.

26103Re: GA code question

Expand Messages
  • Jared
    Jun 1, 2010
      It looks like the PHP isn't being interpreted?

      If you see <?php in the HTML source of the page, it means the PHP isn't being 'run' by the webserver. It could be that the form within Analyticator doesn't accept raw php. When I was testing this code, I had to disable my GA plugin and instead run it from a custom include in the footer.

      Let me know what you think.
      -Jared


      --- In webanalytics@yahoogroups.com, Massimo Paolini <massimopaolini@...> wrote:
      >
      > Hi Jared,
      >
      > Thanks for responding, I really liked your post. Once I resolve this issue
      > I'll need categories.
      >
      > Here is the html generated from the plugin. It looks like it should be
      > working. However, by poking around in firebug, I saw and removed an older
      > test I was doing with StatsIt. I also just realized that I installed W3
      > Total cache on the test site too, could it be interfering?
      >
      > <!-- Google Analytics Tracking by Google Analyticator 6.1.1:
      > http://ronaldheft.com/code/analyticator/ -->
      > <script type="text/javascript">
      > var analyticsFileTypes = ['doc','exe','js','pdf','ppt','tgz','zip','xls'];
      > var analyticsEventTracking = 'enabled';
      > </script>
      >
      > <script type="text/javascript">
      > var _gaq = _gaq || [];
      > _gaq.push(['_setAccount', 'UA-9248008-1']);
      > _gaq.push(['_trackPageview']);
      > _gaq.push(['_setVar', 'admin']);
      >
      > setTimeout('_gaq.push([\'_trackEvent\', \'NoBounce\', \'Over 10
      > seconds\'])',10000);
      >
      > <?php $posttags = get_the_tags();
      > if ($posttags)
      > {
      > foreach($posttags as $tag)
      > {
      > echo "_gaq.push(['_trackEvent','PostTag','View','$tag->name']);";
      > }
      > }
      > ?>
      >
      > (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>
      >
      > Thanks,
      > Massimo
      >
      >
      > On Sun, May 30, 2010 at 9:41 AM, Jared <huber_jared@...> wrote:
      >
      > >
      > >
      > > Hi Massimo,
      > > Glad to see you found the tag tracking method helpful!
      > >
      > > I'm not sure exactly how the Google Analyticator plugin works. The code
      > > looks right, but the plugin may not butcher raw php from the form input.
      > >
      > > Can you paste the resulting HTML?
      > >
      > > Thanks,
      > > Jared Huber
      > >
      > >
      > > --- In webanalytics@yahoogroups.com <webanalytics%40yahoogroups.com>,
      > > "Massimo" <massimopaolini@> wrote:
      > > >
      > > > Hi all,
      > > >
      > > > Here is a simple but frustrating GA code problem.
      > > > I need to add code to a WordPress blog for tracking post tags as an
      > > event.
      > > >
      > > > The client uses WordPress and Google Analyticator.
      > > >
      > > > We started by modifying the code from this blog post:
      > > http://jaredhuber.com/wordpress/track-wordpress-post-topics-in-google-analytics-using-trackevent/and then translated it to async.
      > > >
      > > > We also used these resources and others to check the code:
      > > >
      > > http://code.google.com/apis/analytics/docs/tracking/asyncMigrationExamples.htmland other sources to no avail.
      > > >
      > > > I added the following to the plugin after the tracker initialization.
      > > >
      > > > <?php $posttags = get_the_tags();
      > > > if ($posttags)
      > > > {
      > > > foreach($posttags as $tag)
      > > > {
      > > > echo "_gaq.push(['_trackEvent','PostTag','View','$tag->name']);";
      > > > }
      > > > }
      > > > ?>
      > > >
      > > > However the code breaks GA tracking all together, it's probably staring
      > > me in the face... Any suggestions?
      > > >
      > > > Thanks,
      > > > Massimo
      > > >
      > >
      > >
      > >
      >
      >
      > [Non-text portions of this message have been removed]
      >
    • Show all 8 messages in this topic