Monitor Your Project Server Investment by Measuring Project Web Access Traffic and Usage

When it comes to implementing Project Server, many would agree that installing and configuring the tool is the easy part; the hard part comes when you try to ‘motivate’ everyone in the organization to use the system properly and consistently. Although forcing some people to log their task progress or view the online reports that you spent hours building can be an exercise in futility, at least we can monitor usage patterns to get some insight into who IS using the system and which features or reports / views they are using on a regular basis.

This technique is for PWA only and will not allow you to see Project Professional usage, and it will not allow you to see ALL areas of PWA that people are accessing. Although this technique is limited to monitoring usage of any PWA web part page that is editable via the web browser, it does not require any direct server-level access to implement. Here’s how it works:

  • Create a somewhat hidden custom SharePoint list (‘traffic log’) within the PWA web site to track page visits.
  • Switch one or more PWA pages into edit mode and drop some javascript into a Content Editor Web Part (CEWP); the javascript will grab the page’s address whenever the page is visited and create a new entry in the ‘traffic log’ list.

That’s it… nothing to it! Let’s get started…

Create the Traffic Log

1. Visit PWA and select Site Actions > Create:

clip_image001

2. On the Create page, select Custom List:

clip_image002

3. On the New page, enter a Name for the list (such as trafficlog), select No for Display this list on the Quick Launch, then click the Create button:

clip_image003

4. On the trafficlog page, select Settings > List Settings:

clip_image004

5. On the Customize trafficlog page, in the Columns section, select the Title column:

clip_image005

6. On the Change Column page, change the Column name to page, then click the OK button:

clip_image006

7. On the Customize trafficlog page, scroll down to the Views section and click the All Items view:

clip_image007

8. On the Edit View page, select the Display check box next to the Created and Created By columns, then click the OK button:

clip_image008

Add Javascript to Pages for Tracking (Using PWA Home Page as Example)

1. Visit the desired PWA page (the PWA Home page, in this example) and select Site Actions > Edit Page:

clip_image009

2. With the page in edit mode, click the orange Add a Web Part bar that spans the entire width of the Header web part zone above the Reminders web part:

clip_image010

3. In the Add Web Parts to Header dialog, scroll down to the Miscellaneous section, select the Content Editor Web Part, then click the Add button:

clip_image011

4. With the CEWP on the page, open the edit menu (located in the upper right corner of the new web part) and select Modify Shared Web Part:

clip_image012

5. In the newly-opened Content Editor Web Part panel on the right side of the page, click the Source Editor… button:

clip_image013

6. In the Text Entry dialog box, paste the following javascript, then click the Save button:

//********** START COPY JAVASCRIPT BELOW THIS LINE **********

<script language="javascript">

function PostToTrafficLog()

{

var siteurl = "http://yourprojectserver/pwa&quot;;

var trafficlogname = "trafficlog";

try

{

wsURL = siteurl + "/_vti_bin/Lists.asmx";

//SOAP Action and XML

var wsSoapAction = "http://schemas.microsoft.com/sharepoint/soap/UpdateListItems&quot;;

var wsXML = ‘<?xml version="1.0" encoding="utf-8"?>’;

wsXML += ‘<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot; ‘;

wsXML += ‘xmlns:xsd="http://www.w3.org/2001/XMLSchema&quot; ‘;

wsXML += ‘xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">&#8217;;

wsXML += ‘<soap:Body>’;

wsXML += ‘<UpdateListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">&#8217;;

wsXML += ‘<listName>’ + trafficlogname + ‘</listName>’;

wsXML += ‘<updates>’;

wsXML += ‘<Batch OnError="Continue" ListVersion="1">’;

wsXML += ‘<Method ID="1" Cmd="New">’;

wsXML += ‘<Field Name="ID">New</Field>’;

wsXML += ‘<Field Name="Title">’+ window.location.href + ‘</Field>’;

wsXML += ‘</Method>’;

wsXML += ‘</Batch>’;

wsXML += ‘</updates>’;

wsXML += ‘</UpdateListItems>’;

wsXML += ‘</soap:Body>’;

wsXML += ‘</soap:Envelope>’;

//Create XML Document and get HTTP response using XMLHTTP object

var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");

var httpResponse = getServiceResults(wsURL, wsSoapAction, wsXML);

}

catch(Exception)

{

// Suppress any excess script errors to avoid user confusion.

}

}

function getServiceResults(url, soap, xml) {

//Send XML packet to web service and return HTTP response text

try {

if (xml.length > 0) {

xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");

xmlHttp.open("POST", url, false);

xmlHttp.setRequestHeader("SOAPAction", soap);

xmlHttp.setRequestHeader("Content-Type", "text/xml");

xmlHttp.send(xml);

if (parseInt(xmlHttp.status) == 404) {

return 404;

}

else {

return xmlHttp.responseText;

}

}

}

catch(e) {

alert(e.message);

}

}

PostToTrafficLog();

</script>

//********** END COPY JAVASCRIPT ABOVE THIS LINE **********

NOTE: You will need to change the following two values in the javascript, located on lines 4 and 5:

var siteurl = "http://yourprojectserver/pwa&quot;;

var trafficlogname = "trafficlog";

siteurl is the URL of your PWA site, and trafficlogname is the name of the custom traffic log list that you created previously. Update the values between the quotation marks to reflect your system.

clip_image014

7. In the Content Editor Web Part panel, expand the Appearance section, then enter a Title for the CEWP (such as Traffic Logger) and select None for Chrome Type (you may need to scroll the panel downward) and click the OK button:

clip_image015

8. Select Exit Edit Mode in the upper right corner of the page:

clip_image016

Repeat steps 1-8 in this section for every PWA page that you would like to monitor.

View the Traffic Log

If you chose to hide the trafficlog list from the Quick Launch menu, there is no direct way to access it; here is one option:

1. Click on the Documents heading in the PWA Quick Launch menu:

clip_image017

2. On the All Site Content page, click View All Site Content at the top of the Quick Launch menu:

clip_image018

3. On the All Site Content page, click trafficlog, located below the Lists heading:

clip_image019

Each time someone visits a PWA with the javascript tracking code, a new entry will be added to the trafficlog list:

clip_image020

Pages That Will Accept the Tracking Code Easily

Not all PWA pages are editable within the web browser; here are a few pages that are:

  • Home
  • My Work (tabbed Tasks, Timesheet, and Schedule page)
  • My Tasks
  • My Timesheet (not My Timesheets!)
  • Project Center
  • Resource Center
  • Resource Assignments
  • Data Analysis
  • Task Updates Approvals
  • Administrative Time Approvals
  • My Queued Jobs
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s