SharePoint 101: installing Google Analytics

A more basic post, but hopefully helpful to someone out there. Also, a more in-depth response to my article on Microsoft’s “Get the Point” blog.

To install Google Analytics in your SharePoint 2010 environment, my approach is to use the Master Page. There are two basic steps here, so it shouldn’t take you more than a few minutes.

  • Step 1: Get tracking code
  • Step 2: Edit Master Page

Step 1: Get tracking code

It’s important when you are copying your tracking code from Google Analytics that you have set up your account correctly. Because SharePoint is often run on https, you’ll want to make sure it doesn’t make a non-secure call to Google Analytics. If you’ve set up your site in Google Analytics to use the correct protocol (http vs https), then the tracking code should reflect it. In general though, your code should look like this:


<script type="text/javascript">// <![CDATA[
var _gaq = _gaq || [];
 _gaq.push(['_setAccount', 'UA-XXXXXXX-X']);
 _gaq.push(['_trackPageview']);

(function() {
 var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
 ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
 var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
 })();
// ]]></script>

Step 2: Edit Master page

  1. Open SharePoint Designer
  2. Go to Master Pages
  3. Right-click on your Master Page and click “Edit  File in Advanced Mode”
  4. Scroll all the way to the bottom (just above the closing ‘body’ tag)
  5. Paste the tracking code

Done!

Guest article on EUSP: itemstyle.xsl for designers

Recently had one of my articles garner a little bit of attention and it is now cross-posted on endusersharepoint.com for your viewing pleasure: Itemstyle.xsl in SharePoint 2010 – A guide for designers

Thanks EUSP!

Interesting updates to SharePoint Document Navigator

Ran across Scott Jones’ article detailing some updates/tweaks he’d made to the SharePoint Document Navigator package I released in late May on CodePlex. Glad to see it’s gathering some momentum and people are finding good use for it. And you might see some of Scott’s updates in a new version of SPDN soon!

 

SharePoint Scheduling Assistant – Installation Instructions

This is a complete front-end installation. Meaning power users should be able to handle getting this up and running. For the developers among us, I’m sure you can take the ideas behind this and package them up into a nice back-end solution/wsp to take the power out of the power users’ hands :).

  • Step 1: Create a new blank site
  • Step 2: Create a new list(s)
  • Step 2: Upload files
  • Step 3: Book time slots!
First, you might want to download it on CodePlex.

Create a new blank site:

When the schedule.aspx loads, it looks for any custom lists that you’ve created. So it works best if you create a new “blank site” (which includes no lists).

Create a new list:

This is the template you must use for this to work. The following columns must be in place. For best results, make one list, save it as a list template (with content), and duplicate to allow users to book appointments with multiple teachers all at once.

  • List Name: [Teacher Name]
  • List Description: [Contact details of teacher]
  • List Columns:
    • Title (Single line of text *required)
    • Block Start (Date & Time)
    • Block End (Date & Time)
    • Status (Choice – Open/Closed)

Populate the list with a bunch of open slots. You’ll notice in the screenshot below that the default title is “None” and the Status is set to “Open”. Each item is unique, so you can choose which time slots to use for this booking (they are in 15 minute increments in this example).

Upload Files

Upload all SP Scheduling Assistant files into a document or wiki page library of your choice. Then click on “schedule.aspx” and you’re ready to go!

SharePoint Scheduling Assistant (built with jQuery Mobile and SPServices)

This is a solution I’ve been working on for a while that enables parents to login and reserve time slots with teachers (think Parent-Teacher conferences). Keep in mind, this does not implement any kind of calendaring. I think we’re all quite familiar with areas in which SharePoint is lacking. Thus, I have avoided using calendars at all in this. If you want to book appointments using calendars, I’d suggest Outlook :).

Consider also, this does not have to be for teacher-parent booking only. Imagine using this to book venues, laptop carts, really anything and everything that has time slots available. It might not take the place of things like Outlook, but it’s an interesting way to use SharePoint for some of it.

Note: after much deliberation I’ve decided to open source this bad boy (check it out on CodePlex). I figured in lieu of cash, I’d rather see what people do with it, and how they improve upon it. For installation instructions, click here.

Ok, here are the screenshots (to download from CodePlex, click here)

On the home screen, a parent will see a list of teachers

After selecting one (or multiple) teachers and clicking “Go”, they will be presented with the schedule of those teachers. Any unavailable slots will be grayed out.

To reserve a time slot, the user clicks on the list item and is prompted for the student’s name. This is an additional step to further clarify who the appointment is for (if your parents and children are not “linked” in SharePoint).

Upon entering a name and clicking ok, you get a confirmation message and a confirmation email (if you’ve setup a workflow on the list).

To see your entire schedule click “My Schedule”

If you would like to change your reservation, click “delete reservation” and go back to “Select Teachers” to select a new time slot.

SP Document Navigator Installation

Download and unzip the package

Create a document library (if it doesn’t already exist) called “Shared Documents” and upload some dummy documents

Create a new document library called “Mobile”

Open the document library in windows explorer, and drag all files into the library

Click on “documents.aspx”, and enjoy!

SharePoint SEO: generate meta descriptions for your public-facing SharePoint pages

No, Meta Description tags are not dead. Keywords, sure. But not descriptions. They’re great for making sure your pages are accurately represented in search results, and they tell the search engines a bit more about your page. This is important to me because as I finish touching up a new public-facing website in SharePoint 2010, I’m on a mission to make sure our SEO and rankings don’t take a dip as a result of the switch. Getting your hands into SharePoint to tweak things like meta tags, etc. can be tricky. But here is a (seemingly) simple solution.

For info on what Google says about best practices for meta description tags, click here

So here goes:

  1. Create a new site column (my preferred method) called Meta Description
  2. Add this new site column to your custom content type (still keeping things clean)
  3. Add the following code to the HEAD section of your Master Page:
     <asp:ContentPlaceHolder id="myMetaDescription" runat="server" />
  4. Add the following code to your custom page layout (I put mine at the bottom). Note that the SharePointWebControls (commented out here) piece is the custom column that we created earlier. So your FieldName will naturally be different than mine. Uncomment and replace with your field.
    <asp:Content ContentPlaceholderID="myMetaDescription" runat="server">
     <asp:literal ID="meta1" runat="server" Text="&lt;meta name=&quot;description&quot; content=&quot;"/>
     <!-- <SharePointWebControls:NoteField FieldName="0383b91e-83c4-4bc3-9ce3-d40e7a8acebb" runat="server"></SharePointWebControls:NoteField> -->
     <asp:literal id="meta2" runat="server" Text="&quot;&gt;" />
    </asp:Content>
    
  5. Now, when you click Edit Properties on your page, you’ll see a field called Meta Description, which is where you’ll type a short snippet that search engines will love!

To double check everything, create a new page, edit its Meta Description field, and then view source in your browser to make sure your description is coming through. Caveat: if you don’t put anything in the meta description field, this won’t play well. Looking for a fix to only show the meta tag if there is a description. Will update if I find it.

And of course, if you have a better way of doing this, or any suggestions, let me know!

Credit: most of this solution was created from code on this forum.

#update [05/25]: I just stumbled across this solution here as well. I’m not sure which came first…but thanks to whoever it was!