Add google analytics to SharePoint, SharePoint 2013 and SharePoint online (Office 365)

Intro

Google analytics can provide a very concise overview on how your website is doing. It generates nice reports and hosts clear reports.

It is also possible to use google analytics to track usage on an intranet site built on SharePoint, SharePoint 2013 or SharePoint online.

In this tutorial i will explain the steps to implement analytics to your SharePoint site.

 

Prerequisites:

  1. You need a google account
  2. You need permissions to edit (master)pages in SharePoint

Steps

In short:

  1. go to google.com/analytics to generate an analyticsID
  2. copy some code to the site you’d like to track

Not so short:

  • go to http://google.com/analytics
  • Create an account (see this as a group for the sites you track)
  • Add a new property (a new site to track)

google analytics

  • Retrieve the tracking-ID
  • Select the script provided (start at <script> and copy including </script>)
  • trackingID code
  • Open SharePoint designer and navigate to the masterpage folder.
  • Open the masterpage you are using for your intranet (in my case its Seattle)
  • Open and edit the .html version (the .aspx will be modified by SharePoint after editing)
  • scroll all the way to the bottom and look for the tag </body>find body tag
  • past the analytics code just above the </body> tag past analytics code
  • save the masterpage

Now the tracking data will be sent to google analytics. It may take some time before the results start to roll in but they will.

 

first resultsFirst results coming in after just a minute.

 

 

Why the SharePoint 2013 search results web part is not showing all results

Why the SharePoint 2013 search results web part is not showing all results

I added the search results webart to my teamsite in order to create a dynamic list with all subsites. But the strange thing I noticed was that when building the query the search results preview was showing all subsites, and after i added the webpart to my site it didn’t anymore. It only showed a couple.

The reason this happens is because SharePoint 2013 search is trimming the search results. In this case it finds a couple of results that are quite similar and by default duplicates are filtered out of the result set.

You can view duplicates but you’d have to hover over a search result that in fact has a duplicate.

In the next screenshots i will explain what happened and how i fixed it.

Search results query webpart with preview

Webpart showing only two results instead of four

The fix

We need to change the TrimDuplicates parameter and set it to false. Unfortunately it is not a setting in the Edit Web Part properties pane. So we will have to download the web part and change the parameter using an editor.

Edit the web part

Find TrimDuplicates and change it’s value from true to false.

Search Results.webpart

Save the file and rename it if you like.

Upload the edited web part

Add the web part to the site

After you’ve uploaded the new web part it’ll show up in the list under Imported Web Parts

Fixed it!

Hide the Recent tab in SharePoint Navigation

I have never liked the “Recent” tab in the SharePoint QuickStart navigation.

Hide Recent 1

So here is a way to hide it forever! We do this by editing the properties of the link in the navigation settings of the site. We will display the link to all members of a newly created group. The thing is that there are no members in that group (other than the farm administrator of course).

 

Step 1

Go into Site settings.

Hide Recent 2

Step 2

Open People and groups to create a new group

Hide Recent 3

 

Step 3

Switch the view to Groups

Hide Recent 4

 

Step 4

Click “New” to creat the new group.

Hide Recent 5

 

 

Step 5

Give the new group a name and enter a description.

Hide Recent 6

Shouldn’t it say Group Description or something?

Leave all settings default and click “Create”.

Step 6

Delete yourself from the group

Hide Recent 8

If you created the group logged in with the system administrative account the group will be empty. 

 

Step 7

Go into Site settings and Navigation

Hide Recent 9

And scroll down to Structural navigation

Step 8

Select the Recent heading and click on “Edit”

Hide Recent 10

 

Step 9

Edit the properties for this Heading.

Find the newly created group by clicking on the address book.

Hide Recent 11

Select “SharePoint Groups”

Hide Recent 12

Search, select, add and hit “OK”

Hide Recent 13

 

If all went well you should see this screen. Just click “OK”

Hide Recent 14

And now the Recent heading will be hidden.

Hide Recent 15

Add extra result types and properties to the advanced search page

Step 1

First open the advanced search page.
This page can be found at <sitecollection>/search/advanced.aspx Result types 1

Step 2

Edit the page

Result types 2

Step 3

Edit the webpart

Result types 3

Step 4

Open the builder window to edit properties

Result types 4

Step 5

Once in the builder window, select all contents by hitting CTRL-A and copy it with CRTL-C Result types 5

Step 6

Open Visual Studio (or any other editor) and create a new XML file. We are not going to save this file but pasting it into visual studio formats the text so it is outlined properly. Result types 6

Step 7

Remove the default header. (CTRL-A and DEL)

Result types 7

Step 8

And paste the XML from the webpart Result types 8

Looks much better doesn’t it?

Step 9

First we’ll create a new ResultType Select the “Documents” ResultType. Copy and past it at the end of the ResultTypes section.

Result types 9

Step 10

Rename “Documents”. In this case we are going to use “Manuscripts” Result types 10

Step 11

Next we’ll create a new property definition Result types 11

Step 12

Add the new Property Definition to the new ResultType Result types 12

Step 13

Copy all text and paste it back into the Builder window in SharePoint Result types 13 And click OK

Step 14

Click OK to save the changes to the Webpart and save the page.

Result types 14

Don’t forget to check in and publish the page.

Et voila!

Result types 15

SharePoint 2013 Crawl job will not stop

When you are unable to stop a crawl (full or incremental) using the central admin, you can try these additional steps.

  1. Stop and start the SharePoint Server Search 15 service
    1. Do this by going into services.msc (Hit Windows, R and type services.msc)
    2. Find the service and hit restart
  2. Run this powershell script on your SharePoint server

Add-PSSnapin "Microsoft.SharePoint.PowerShell"

Get-SPEnterpriseSearchCrawlContentSource -SearchApplication "Search Service App" | ForEach-Object {
if ($.CrawlStatus -ne "Idle")
{
Write-Host "Stopping currently running crawl for content source $($
.Name)..."
$.StopCrawl()
do { Start-Sleep -Seconds 1 }
while ($
.CrawlStatus -ne "Idle")
}
Write-Host "Starting full crawl for content source $($.Name)..."
$
.StartFullCrawl()
}

This should get things going again. ​

SharePoint 2013 Search – Create new managed property

In this tutorial I will explain how to create a Managed Property. Once created you can utilize them in search as refiners, search properties and more.

Let’s say i want to create a managed property from a list column called: Events & Journals

#Step 1
Because the column name has a & sign in the name i will first have to determine the system name of this column.
To do that go to the list settings and edit the desired column. In the URL you can see what the internal system name for this column is. In our case it is: Events_x0020_journals.

Lookup Column name

 

#Step 2

Open up SharePoint Central Admin and go to the Manage service applications page.

Go to Manage service applications

 

#Step 3

Open the Search Service Application page

Open search service application

 

#Step 4

Managed properties can be found in the Search Schema section

Search Schema section

 

#Step 5

First lookup the name for the list column. This will have the prefix of ows_
Click on Crawled Properties then enter the name (or a part of the name) of the column and hit Enter. You can see that the column is found and that the name is: ows_Events_x0020_Journals. 

Clicking on Managed Properties will take you to the screen where you can create a new one.

Lookup the proper tie name

 

#Step 6

Click on New Managed Property

Click new managed property

 

#Step 7

Enter a name for the new property, select the type and check the boxes for the main characteristics.

New managed property

 

Read the text next to the checkboxes to help you decide if you need that functionality.

#Step 8

Scroll down to Mappings to add a mapping to for this new property.

New mapping

 

#Step 9

First enter the column name we found in step 1, then click find. Select the right property and hit OK.

Select crawled property

 

 

This will create the new Managed Property

#Step 10

Type the name in the Filter field and hit Enter to check if the property exists.

Check for existence

 

#Step 11

To wrap things up you will have to start a full crawl before the new Managed Property is available. Goto the Content Sources and click on Start Full Crawl in the drop down menu for the content source where you want to use the new Managed Property.

 

#That’s it.

Happy searching.

 

In this post you can read how to utilize the Managed property in the advanced search page.

SharePoint 2013 Search. Add extra result types and properties to the advanced search page

Step 1

First open the advanced search page.
This page can be found at /search/advanced.aspx

First-open-the-advanced-search-page-This-page-can-be-found-at--search-advancedaspx

Step 2

Edit the page

Edit-the-page

Step 3

Edit the webpart

Edit-the-webpart

 

Step 4

Open the builder window to edit properties

Open-the-builder-window-to-edit-properties

 

Step 5

Once in the builder window, select all contents by hitting CTRL-A and copy it with CRTL-C

Once-in-the-builder-window--select-all-contents-by-hitting-CTRL-A-and-copy-it-with-CRTL-C

 

Step 6

Open Visual Studio (or any other editor) and create a new XML file.

We are not going to save this file but pasting it into visual studio formats the text so it is outlined properly.

Open-Visual-Studio--or-any-other-editor--and-create-a-new-XML-file

 

Step 7

Remove the default header. (CTRL-A and DEL)

Remove-the-default-header--CTRL-A-and-DEL-

 

Step 8

And paste the XML from the webpart

And-paste-the-XML-from-the-webpart

Looks much better doesn’t it?

Step 9

First we’ll create a new ResultType

Select the “Documents” ResultType. Copy and past it at the end of the ResultTypes section.

First-we-ll-create-a-new-ResultType

 

Step 10

Rename “Documents”. In this case we are going to use “Manuscripts”

Rename--Documents--In-this-case-we-are-going-to-use--Manuscripts-

 

Step 11

Next we’ll create a new property definition

Next-we-ll-create-a-new-property-definition

 

Step 12

Add the new Property Definition to the new ResultType

Add-the-new-Property-Definition-to-the-new-ResultType

 

Step 13

Copy all text and paste it back into the Builder window in SharePoint

Copy-all-text-and-paste-it-back-into-the-Builder-window-in-SharePoint

And click OK

Step 14

Click OK to save the changes to the Webpart and save the page.

Click-OK-to-save-the-changes-to-the-Webpart-and-save-the-page

Don’t forget to check in and publish the page.

Et voila!

Et-voila-

Workflow will not start. The form cannot be rendered. This may be due to a misconfiguration of the Microsoft SharePoint Server State Service.

Problem:

A workflow that is created with SharePoint Designer cannot be started.
The following error appears:

Error: The form cannot be rendered. This may be due to a misconfiguration of the Microsoft SharePoint Server State Service. For more information, contact your server administrator.

Reason:

The startscreen for the workflow, which is actually an InfoPath form, cannot be displayed. This is because the State Service is not installed or is not active.

Resloution:

Start a SharePoint 2013 Management Shell session and enter these commands to setup a State Service.
$ss = New-SPStateServiceApplication -Name "State Service"
New-SPStateServiceDatabase -Name "WSS_StateService" -ServiceApplication $ss
New-SPStateServiceApplicationProxy -Name "State Service Proxy" -ServiceApplication $ss –DefaultProxyGroup

Getting: Microsoft.AnalysisServices.SPAddin.ReportGallery.ReportGalleryView when creating a PowerPivot Gallery in SharePoint 2013

If you get this message Microsoft.AnalysisServices.SPAddin.ReportGallery.ReportGalleryView when you try to create a PowerPivot Gallery here’s what you should do.

Deploy powerpivotwebapplicationsolution.wsp to your web app

To do this you go into the central admin, manage farm solutions. You can find it under System settings. There you can deploy the solution to your web app.  (it is probably only deployed to the central admin web app)

 

Good luck!