1

When using Google Analytics on Sharepoint how can I clean up the URLs?

I want to have a better idea of what my users are actually doing vs. seeing things like:

http://sp.company.com/sites/blah/Documents/Forms/AllItems.aspx?RootFolder=%2Fsites%2Fblah%2Ffolder1%2Ffolder2&FolderCTID=0x00000000000000000000000000000000000000&View=%7123456789%212345%212345%212345%21234568936418%7D

1

Stack Overflow answer I am posting my own answer because I couldn't when I searched and I hope this might help someone else in the future.

First you want to configure the site search settings:

  1. Sign in to Google Analytics
  2. Click Admin, and navigate to the account in which you want to create the filter.
  3. In the ACCOUNT column, click View Settings
  4. Turn on "Site search Tracking"
  5. Enter the letter "k" into the Query pramater and turn on "Strip query parameters out of URL"
  6. Turn on "Site search categories"
  7. Enter the letter "u" into the Query pramater and turn on "Strip query parameters out of URL"

Next you want to configure Google Analytic View Filters:

  1. Sign in to Google Analytics
  2. Click Admin, and navigate to the account in which you want to create the filter.
  3. In the ACCOUNT column, click All Filters.
  4. Click + New Filter. (If this button is not visible, you do not have the necessary permission.)
  5. Select Create new Filter.
  6. Enter a name for the filter.
  7. Select Custom Filter
  8. Select Search and Replace Filter
  9. Set the Filter Field to "Request URI"
  10. Follow the instructions attached for each Regex below

You're going to want to create a separate filter for each of these regular expressions. Order is important; it will apply the first filter first etc. These are designed to be in this order so it may not work if the order is incorrect

Filter Pattern: ((\?|\&)(RootFolder|FileName)=(\s|\&|\*))
Replace String: [Leave this Blank]
What it does: Removes blank RootFolder + FileName attributes so we can use this in future queries

Filter Pattern: ^.*((\?|\&)(RootFolder|FileName|url|DestUrls|AssetUrl|SPAppWebUrl)=)
Replace String: [Leave this Blank]
What it does: Takes the actual location that a user is querying instead of the originating URI. This is more useful to see what your people are doing and what files they are accessing

Filter Pattern: (\&Source=iframe&screenColor)(.*) Replace String: [Leave this Blank] What it does: Removes embedded IFrame Apps

Filter Pattern: ^.*((\?|\&)(Source)=)
Replace String: [Leave this Blank]
What it does: Does the same as the second filter

Filter Pattern: (((\?|\&)FilterField1=(.*)FilterValue1=)|((\?|\&)FilterField2=(.*)FilterValue2=)|((\?|\&)FilterField3=(.*)FilterValue3=)|((\?|\&)TreeField=(.*)TreeValue=)|((\?|\&)ServerFilter(.*)FilterValue1=))
Replace String: /
What it does: Turns filters into fully qualified paths. Same effect as Filter # 2

Filter Pattern: ((\?|\&)Use)(.*)|(\#)(.*)|List\=(.*)|(\?)(.*))
Replace String: [Leave this Blank]
What it does: Removes useless (for this purpose) paramters that sharepoint uses in their URIs and cleans up orphaned "List" values from filter #1

Filter Pattern: ((\?|\&)(MDWeb|PageView|InitialTabId|SortField|showLimitedAccessUsers|View|AssetPageFolder|AssetType|ContentTypeId|Dialog|RecSrc|AddToView|sname|t|DefaultList|target|ProcessQStringToCAML|List|IsDlg|FolderCTID|ID)=)(.*)
Replace String: [Leave this Blank]
What it does: Cleans out more sharepoint stuff

Filter Pattern: (^.*\.sharepoint\.com|^\s|\=$)
Replace String: [Leave this Blank]
What it does: Cleans up some of the URIs that we created in the previous steps to match the rest of the data

Filter Pattern: (\+| %20)
Replace String: Space; [what is between the double quotes] " "
What it does: Makes URIs more friendly to read

Filter Pattern: %2F
Replace String: /
What it does: Makes URIs more friendly to read

Hope this helps you future people searching.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.