Create valid xHTML-Strict, Search-Friendly iFrames Using jQuery

Web Developers continue to argue whether it’s really that important to validate every website using the “Strict DOCTYPE”, or if valid website markup code is really even that important. While this is a discussion for another time, I try to publish every site I author in valid, Strict xHTML. I believe standards are made for a reason, and if you wish to write good code – just follow the standards.

Occasionally I find the need for a page element that is not considered valid xHTML-Strict markup. One big one that has come up is the good ole’ “iFrame” tag. Granted you can always change the DOCTYPE to “Transitional” and still have valid code, or you can use the “Object” tag to get the same results and be valid. In the past I’ve done both of these, but I’d rather use the Strict DOCTYPE and let’s face it; “Object” tags simply do not play nice across browsers.

Also, sometimes you want to embed xHTML strict iFrame Vimeo videos, or Amazon iFrames that are SEO-friendly. I’m sure there are other ways to display this sort of external web content (ajax, CURL), but I’ve yet to find any useful when building simple pages. Regardless, I found what I think is a MUCH better solution to including iFrame content, both technically speaking and considering Search Engine Optimization (SEO; search bots don’t like iFrames).

Note: This outline is designed for people with at least a little to moderate web design and developing experience. Also, this technique is a workaround that is Search Engine friendly for use when iFrame content is inevitable. It should be noted that iFrames are not valid elements for a reason and should be filtered out if possible. While this will allow your pages to “validate”, it’s really just tricking the browser.

Continue reading

Track downloads with Google Analytics using jQuery

If you currently use Google Analytics for website statistics, but want to get even more details on what your visitors are doing on your site – you may want to implement custom event tracking. Using this method, you can track nearly every action a user takes on your site. External link clicks, email link clicks, file downloads and more can all be tracked and recorded. Any webmaster will tell you; the more details you can get about your visitors – the better you can cater to them and increase your return on investment.

I am constantly trying to better my understanding of my site’s visitors. Using custom tracking has allowed me to adjust my content ever-so-slightly, creating a significant increase in conversion rate. For example, one big item has been the ability to track what links people are clicking to leave my sites. I found that there were a few links that got clicked way more than the rest. Using this knowledge, I created content on my site that was similar to the link the users where clicking. After a bit of tweaking, I was able to retain that visitor and increase my conversion rate.

I’ve asked new clients before about their current site activity, and received confused “i have no clue” responses. After installing Google Analytics and generating some reports – the client is always amazed. They had no clue certain pages were the best traffic, or that certain pages rank for certain keywords.The bottom line is this; If you don’t have detailed reports on your web traffic, you’re missing the boat. The method below just adds a new layer of detail to what your site is (or can be) doing.

Continue reading