I recently re-did the www.netconnex.com web site using the My Web Pages Starter Kit. I needed to get google analytics setup on it, so here is what I did:
- Installed James Newton Kings sitemap handler
- Setup the www.netconnex.com website in Google’s Webmaster Tools
- In Google’s webmaster tools, the www.netconnex.com/sitemap.axd sitemap to the list of sitemaps
- When to Google Analytics, setup an account for my site and copied the tracking code they provide (here’s how to get the tracking code for an existing account).
- Opened the site in Visual Studio 2008, and edited the site.master file
- I pasted the tracking code I copied from Google Analytics to the bottom of the site.master file, just before the closing body tag (</body>)
- Saved the site.master!
FYI, I also copied the output of the www.netconnex.com/sitemap.axd file to a file in the root of the website called sitemap.xml . This way if there were any tools that looked specifically for the sitemap.xml file they would find it.
I let it sit for a day, and checked in on Google Analytics the next day, and I had stats for all of my sites pages.
UPDATE: Based on the comments, I have created a zip file with my web.config and site.master files in it. You can Download the sample files here
Hi Bret
I managed to insert the tracking code, no problem.
What I am battling with is the sitemap.
Where exactly do I put the
add verb=”*” path=”sitemap.axd” type=”Newtonsoft.Sitemaps.SitemapHandler, Newtonsoft.Sitemaps”
My webconfig does not have an httpHandler section:
There does seem to already be a SiteMapProvider?
Excuse my newbness…
systemadmin, when you are adding the sitemaps handler, you need to create an <httpHandlers> section inside the <system.web> element. Here is a snippet of my web.config (the code below will likely wrap):
<system.web>
…
<httpHandlers>
<add verb="*"
path="sitemap.axd"
type="Newtonsoft.Sitemaps.SitemapHandler, Newtonsoft.Sitemaps"/>
</httpHandlers>
…
</system.web>
The SiteMapProvider that you see is a different thing. The SiteMapProvider is what provides data to various ASP.NET SiteMap consumers, like the menu controls. I haven't looked at the source code for the sitemaps handler, but I wouldn't be surprised if it too is pulling its data from the SiteMapProvider.
You can read more about the sitemaps that search engines like google want at sitemaps.org
systemadmin, I have posted a zip file with copies of my site.master and web.config files in it. Download the sample files here
Thanks for your help, Bret! Much appreciated.
Tim
It’s working! Thank you.
Hi, This is working good. Thanks for a nice post. Your explanation is very effective.
http://godwinsblog.cdtech.in/2010/12/sms-integration-with-mwpsk-my-webpages.html
Hi Bret, nice post, good and informative… as systemadmin said i too managed to insert the tracking code no error. Thanks a lot.
http://godwinsblog.cdtech.in/2010/12/application-attempted-to-perform.html