Skip to content

SPFx Application Customizer that logs the number of times a user visits specific pages on an SPO site

Notifications You must be signed in to change notification settings

corkindustry/SPO_Analytics

Repository files navigation

SPO Analytics

Originally built in Nov. 2018 for sp2010. SPFx version built in Jan. 2020 on SPFx 1.12.1
Could probably use some refactoring 😄

About

Track who is visiting your site!
SPO Analytics is an SPFx Application Customizer that logs the number of times a user visits specific pages on an SPO site. The data is saved to a List on the same site. One row per user.

Setup

Clone, package, deploy and install this solution to your site's App Catalog

List Setup

  • Create a List with this exact name: SPO_Analytics
  • New Single Line of Text column: Username
  • New Number column for each page you want to track
    • The column names should match the page names exactly. Use the page's url to ensure that you have the corect name For example, create a column called Home if you want to track your site's homepage
    • Set the Number of decimal places to 0
    • Set the Default value to 0
  • Ensure that everyone visiting your site can write to the SPO_Analytics List
    • This may involve breaking inheritance on the List and giving the Visitors group Contribute rights
  • Sit back and watch the hits roll in!

Troubleshooting

Open devtools, the console should be logging one of these three messages:

  • 'SPO_Analytics' list does not exist on this site
    • Make sure the List is created and named correctly
  • This page is not being tracked
    • There isn't a column for current page. Make sure the column exists and is named correctly
  • creating item
    • 👍 A new user has visited the page
  • updating item
    • 👍 An existing user has returned to the page

If you don't see any of these messages, make sure the app is installed on the site.

Used SharePoint Framework Version

version

About

SPFx Application Customizer that logs the number of times a user visits specific pages on an SPO site

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published