Implementing New Relic Real User Monitoring in Magento

A few months ago, New Relic introduced Real User Monitoring.  It natively supports WordPress and Drupal as of the time of this writing.  By “natively supports”, I mean you can just turn it on in the New Relic control panel and your web servers will start automatically injecting it into your pages’ head.  Real User Monitoring works with any web app, however — you just have to manually add the code yourself.

Here’s how you add it to a Magento theme template. Continue reading Implementing New Relic Real User Monitoring in Magento

Here’s a list of all the default / built-in querystring paramaters (or query variables) used by WordPress:

  • attachment
  • attachment_id
  • author
  • author_name
  • calendar
  • cat
  • category_name
  • comments_popup
  • cpage
  • day
  • debug
  • error
  • exact
  • feed
  • hour
  • m
  • minute
  • monthnum
  • more
  • name
  • order
  • orderby
  • p
  • page
  • page_id
  • paged
  • pagename
  • pb
  • post_type
  • posts
  • preview
  • robots
  • s
  • search
  • second
  • sentence
  • static
  • subpost
  • subpost_id
  • tag
  • taxonomy
  • tb
  • term
  • w
  • withcomments
  • withoutcomments
  • year

New Relic and Magento: Better Transaction Naming

New Relic supports Zend Framework out of the box.  Right?  Supposedly it does, but I didn’t get any useful information recorded when using Magento.  Everything came up “index.php”.

Unfortunately, getting a useful transaction name in New Relic from Magento requires modifying Magento core.  Fortunately, it’s a pretty simple modification.

Continue reading New Relic and Magento: Better Transaction Naming

VirtualBox, Vagrant and Mac OS X: instant linux development environment

Vagrant is a Ruby project that lets you set up a Linux virtual machine very quickly, using VirtualBox. Ideally, at least.  Getting it set up the first time on a MacBook can be tricky.  Here’s how I got it running.

This assumes you’re running Vagrant in your home directory.  Also, I already had VirtualBox installed.

Updated 5/30/2011: The previous instructions added ~/.rvm/scripts/rvm to ~/.bash_profile, which caused RVM’s settings to override anything in your ~/.profile.  See “Gotchas” for more info.

Continue reading VirtualBox, Vagrant and Mac OS X: instant linux development environment

Setting custom values for _trackPageviews in Google Analytics may have unexpected consequences

I recently deployed Joost de Valk‘s awesome Google Analytics for WordPress plugin on a few sites. (I mean, he even SEO’d the plugin name, how brilliant is that?)  One of the features of this plugin will add custom parameters to the URL in your _trackPageviews call so that you can gain insight into what kind of results you return.

For example, if you search for “K-Stew” and get no results, that will get tracked in GA as [“_trackPageview”,””%5D.  Great for being able to view GA reports and realize, hey, people want to see K-Stew and I’m not giving them any!

So what’s the problem? Continue reading Setting custom values for _trackPageviews in Google Analytics may have unexpected consequences

How to add a Google Checkout button to any page in Magento

Image representing Magento as depicted in Crun...
Image via CrunchBase

This post answers a very simple question I had, one I could not find an answer for.  I needed to add additional Google Checkout buttons to Magento‘s onepage checkout and maybe the sidebar cart.  I found other people asking the same thing, and answers ranged from cryptic to unhelpful.  But I did find a solution.

Step 1

Add this snippet to the template file where you want the Google Checkout button to appear:

getLayout()->createBlock('googlecheckout/link')->setTemplate('googlecheckout/link.phtml')->toHtml(); ?>

This uses the standard Google Checkout button that’s used everywhere else, so if you customize the way the GCO button looks using the googlecheckout/link.phtml file your changes will show up everywhere you use it.  This is great because it reduces the duplication of code.  But what if you want to use a slightly modified GCO button somewhere? Read on…

Akismet False Positives when Behind a Load Balancer

Example Prefix WhoIs query
Image via Wikipedia

Here’s the problem: Akismet is marking valid posts as spam when behind a load balancer.  Because of marking comments as spam when Aksimet sees the IP address as coming from your load balancer, and then any comment that comes through gets marked as spam.

There are plugins that do this, to some degree, like Real IP.  But really it’s a simple thing; just put this in your wp-config.php file: Continue reading Akismet False Positives when Behind a Load Balancer

WordPress Must-Use Plugins

"My words fly up, my thoughts remain belo...
Image by ZedZap via Flickr

WordPress has quite a few hidden features.  My favourite so far: MU Plugins, or “must-use plugins”.  Introduced with WP 3.0, the code says:

 * Check the mu-plugins directory and retrieve all mu-plugin files with any plugin data.
 * WordPress only includes mu-plugin files in the base mu-plugins directory (wp-content/mu-plugins).
 * @since 3.0.0
 * @return array Key is the mu-plugin file path and the value is an array of the mu-plugin data.

Continue reading WordPress Must-Use Plugins