Q&A: Google Analytics code in footer using Dreamweaver

Now and then I get some pretty interesting questions, sent to me through my contact form. I got one such question several times, and mostly from marketers who don’t really deal with the back-end of websites and aren’t quite sure how to get Google Analytics code up on their sites.

So the question I’m tackling today is: “How can I include Google Analytics code in the footer of my pages using Dreamweaver?”

Let’s start with some basic instructions on how to include Google Analytics code on your website’s pages. If you intend to update individual pages (not recommended for large sites), simply load Dreamweaver, load the page you’d like to place Google Analytics code on and in the top of your screen click on the Code view button to get into the page’s code.

Dreamweaver code view

Now that you’re in the code, scroll down all the way to the bottom until you find the </body> tag. Just above that tag, copy the Google Analytics code and paste it directly before/above, like so:

Google Analytics code in Dreamweaver

Save your file(s) and that’s it. Google Analytics will start receiving your site’s data shortly, as visitors come in to your site, and you should start seeing populated reports within 24 hours.

If you work with templates in Dreamweaver, load your site’s template file (*.dwt) and follow the same steps to add Google Analytics code to your website’s pages.

Including Google Analytics code in the footer of a website/blog (Wordpress) using php includes

Although this sounds tricky to do, it’s actually quite straightforward and usually works like a charm. The most important thing to keep in mind, however, is that your footer.php needs to include the </body> tag. Although there are workarounds, in most cases the closing body tag is included in the footer.

You can open your footer php file in Dreamweaver and you’ll find yourself in the Code view by default, after which it’s just a matter of copy/pasting the Google Analytics code just above the </body> tag, exactly like the example above.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google
  • Furl
  • NewsVine
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • TwitThis


Open Comments