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

Re: [webanalytics] Re: GA code question

Expand Messages
  • Ramjee Ganti
    Hi Massimo, Not sure what is the problem in your case. Can you stacking up multiple trackingevents one after the other. Can you try the following: i. register
    Message 1 of 8 , May 31, 2010
    • 0 Attachment
      Hi Massimo,
      Not sure what is the problem in your case.

      Can you stacking up multiple trackingevents one after the other. Can you try
      the following:
      i. register the code corresponding to trackevents on window.load. if you use
      jquery it is as simple as $(document).ready(function(){ <your track event
      code> });
      ii. Not sure if the following applies to you but do look at the
      implementation considerations:
      http://code.google.com/apis/analytics/docs/tracking/eventTrackerGuide.html#implementationConsiderations

      Hope you can get the issue resolved. I will try similar code on my blog and
      see if I can root cause (but will take a couple of days, as I can see the
      effect only after a day).


      rAm

      i Think, i Wait, i Fast -- Siddhartha
      Nabler
      www.nabler.com


      On Mon, May 31, 2010 at 6:34 AM, 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@...<huber_jared%40yahoo.com>>
      > 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><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/andthen translated it to async.
      > > >
      > > > We also used these resources and others to check the code:
      > > >
      > >
      > http://code.google.com/apis/analytics/docs/tracking/asyncMigrationExamples.htmlandother 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]
      >
      >
      >


      [Non-text portions of this message have been removed]
    • Jared
      It looks like the PHP isn t being interpreted? If you see
      Message 2 of 8 , Jun 1 7:11 AM
      • 0 Attachment
        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]
        >
      • Massimo Paolini
        I think you re right. I played around a little more with firebug and I can see the script start it doesn t execute the php. I will try a different method.
        Message 3 of 8 , Jun 2 8:19 AM
        • 0 Attachment
          I think you're right. I played around a little more with firebug and I can
          see the script start it doesn't execute the php. I will try a different
          method.

          Thanks,
          Massimo


          On Tue, Jun 1, 2010 at 7:11 AM, Jared <huber_jared@...> wrote:

          >
          >
          > 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 <webanalytics%40yahoogroups.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><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/andthen translated it to async.
          > > > >
          > > > > We also used these resources and others to check the code:
          > > > >
          > > >
          > http://code.google.com/apis/analytics/docs/tracking/asyncMigrationExamples.htmlandother 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]
          > >
          >
          >
          >


          [Non-text portions of this message have been removed]
        Your message has been successfully submitted and would be delivered to recipients shortly.