title: Determine if on product page programmatically in Magento
body: <p>I want to insert tracking codes on all of the pages of a Magento site, and need to use a different syntax if the page is a CMS page, a category browsing page, or a product view page. I have a custom module set up with a block that inserts a generic tracking code on each page for now. From within the block, how can I distinguish between CMS pages, category pages, and product pages? </p>
  
  <p>I started with: </p>
  
  <pre><code>Mage::app()-&gt;getRequest();
  </code></pre>
  
  <p>I can see that </p>
  
  <pre><code>Mage::app()-&gt;getRequest()-&gt;getParam('id');
  </code></pre>
  
  <p>returns the product or category ID on product and category pages, but doesn't distinguish between those page types. </p>
  
  <pre><code>Mage::app()-&gt;getRequest()-&gt;getRouteName();
  </code></pre>
  
  <p>return "cms" for CMS pages, but returns "catalog" for both category browsing and product view pages, so I can't use that to tell category and product pages apart. </p>
  
  <p>Is there some indicator in the request I can use safely? Or is there a better way to accomplish my goal of different tracking codes for different page types?</p>