CornerPixel Blog RSS 2.0

# Monday, September 08, 2008

This won't be the biggest post ever, but it is important none the less.  I have been as of late creating sites with Adobe Dreamweaver and my users have been using Contribute CS3 to edit them.  Now I still hand coded the site for the most part, but I did use the template system that Dreamweaver has and it was pretty effective.

My customer wanted to make sure I put his Google Analytics code into the new site so he could continue monitoring his website.  I didn't think there would be any issue with this and I inserted the Google Analytics code right before the end body tag.

My next step was to allow my user to edit in Contribute CS3.  I got a call later from my customer stating that his page was now looking funny and he was getting extra parenthesis at the bottom of the page.  I looked at the source and saw that Contribute had changed the following code.

type='text/javascript'%3E%3C/script%3E"));

to the literal

type='text/javascript'></script>"));

So now we end up getting  ")); at the bottom of the page.  That isn't good.  It turns out that Adobe Contribute CS3 enforces a level of XHTML compliance, which is more than the Google Analytics code complies with.  Hopefully in the near future Google will change it's code, but in the mean time if you just place the code in the head of the page, Contribute will not change the code.

The other solution is to remove the HTTP/HTTPS auto detection and just use the appropriate script tag for your site.  I don't like this solution because it requires more work, but if you are inclined to do it that method then below is the code for each.

For HTTP:
<script type="text/javascript" src="http://www.google-analytics.com/
ga.js"></script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-XXXX-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>

For HTTPS:
<script type="text/javascript" src="https://ssl.google-analytics.com/
ga.js"></script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-XXXX-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>

Well I hope that helps

~Michael

Monday, September 08, 2008 5:56:28 PM (Pacific Standard Time, UTC-08:00)

#       Comments [0] - Trackback

Code | Web Standards

# Saturday, September 06, 2008

Yesterday I was feeling pretty good about how CornerPixel's website and blog are valid XHTML 1.0 Transitional markup. I had just got done posting my entry about Google Analytics when I decided to run the blog home page through the W3C Markup Validation site

Ackkkkk! I had 78 errors.  What is up with that.  Well I got to looking and I noticed there were markup errors in the blog posts.  Well I use Windows Live Writer to post my blogs and I do it from several different computers throughout the week.  I hadn't had that problem before, so I decided to start looking through Windows Live Writer settings. 

I didn't find anything in the Tools / Options menu, and I was starting to get a little worried.  I did notice that you can view the HTML (markup) so I figured worse case scenario I could just change the markup, but I didn't want to have to do that with every post.

Finally I noticed the Weblog menu.  Under Weblog there is an option to "Edit Weblog Settings"  If you click that you will get a popup window where you can make the necessary changes.  Once the window is open just click "Advanced" on the left and you will see the section where you can choose the Markup Type. 

There you go.  Now Windows Live Writer will spit out good markup.  Wooo hooo !

Weblog Settings window

 

I also noticed that when I had an "&" in the title of the post I got 1 XML parsing error and 1 warning.  So for a good valid blog site with Live Writer, don't place an "&" in the title of your posts.

Well I hope that helps for all you blogger's using Windows Live Writer.

Saturday, September 06, 2008 9:25:58 AM (Pacific Standard Time, UTC-08:00)

#       Comments [0] - Trackback

CMS | Web Standards

# Friday, September 05, 2008

I am getting to the stage where I want to implement Google Analytics and see just how much traffic I am getting on my new website.  I went to Google Analytics and started my account and started the process of getting my script to add to my site.

At this point I was thinking about having to make different profiles for each of my subdomains.  I thought about it and I didn't like that idea.  I would end up getting referrals from my own domains, and that would mess up my stats a fair bit.

Well I did what I always do when posed with an issue I am not sure how to solve.  I went to Google and did a search.  I came up with a very good site and post to help me through.  I found that I just had to add one line of script to my Google Analytics code and all would be good.

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-XXXXXX-X");
pageTracker._setDomainName("domain.com");
pageTracker._initData();
pageTracker._trackPageview();
</script>

Notice the part of the code in bold.  pageTracker._setDomainName("domain.com");

Just change out the domain.com to match your domain and you are good to go.  Above is the simple solution, but for a very cool explanation go to the Google Analytics "Unofficial" Blog.

Friday, September 05, 2008 6:35:37 PM (Pacific Standard Time, UTC-08:00)

#       Comments [0] - Trackback

Code

# Wednesday, September 03, 2008

There was an announcement yesterday about Google's new browser called Chrome.  I went through three different emotions upon hearing about this new browser.

  1. I felt a quick kid like excitement.  I was rushing to download it and try it out.
  2. Then I felt a feeling of worry when I thought that I now had yet another browser to test all my websites against.  So at that point I went to the Chrome site and started to read the little comic they have to explain their new browser.  As I read I found that there was a lot of good sound things about Google's new browser.
  3. Lastly my feeling was amusement and curiosity as I started to realize just how good the browser was.  Here are some of the things I like about Chrome.

Things I like

  • I was happy to see that it passed all the CSS3 tests on the CSS3.info site.  This is encouraging to me and it will be GREAT to test CSS3 stuff and know I have a playground that supports all of CSS3 and not just a little bit of it.
  • I was happy that each tab is it's own process.  That way when a site goes mad and freezes, I don't loose what I was doing on another tab.
  • It is very lite looking but pretty browser.  (ya I know I am a professional and that shouldn't matter.  But it does.)
  • The search bar is the address bar.  I think that is how browsers should have all been made.
  • Most visited sites page.  Kind of cool, but I want to see it in action a couple months from now.
  • Load times are pretty darned fast.

Things I don't like

  • When I was using Chrome on my Vista PC disc bullets were displayed with white corners which made the bullets look like stars at certain sizes.
  • I don't like what it did to my favorites.  It imported my favorites from IE7 and then tried to logically sort them.  I can't find anything anymore.  I wish I hadn't imported them.  My advice is do NOT import favorites.
  • The "Inspect Element" is a nice try but it isn't as good as IE8's Developer Toolbar or Firefox's Firebug extension.  I can't get to a mode where I can hover over the page and click an element I want to inspect.  I can go through the markup and eventually find my element by watching what lights up.  But it just isn't as good as I would like.

Well I think that is it for now.  I am going to use this browser a LOT in the next couple weeks to test things out.  I know I will be able to soon ad much more to both of the above lists.  I can't wait to find out what cool tools Google has added to the browser.  I also can't wait to see if I can take some things off my "Things I don't like" list when I get to know the browser a bit more.

Well thanks Google for giving me more work to do.  The good thing is that I really like my work.

~Mike

Wednesday, September 03, 2008 5:23:53 PM (Pacific Standard Time, UTC-08:00)

#       Comments [1] - Trackback

Browser - Chrome | CSS | Web News

Archive

<September 2008>
SunMonTueWedThuFriSat
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011

Email Subscription

Sign up to get the CornerPixel Blog delivered to your email.

About the Author

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

Sign In

Statistics

Total Posts: 52
This Year: 3
This Month: 0
This Week: 0
Comments: 28