How to Track SharePoint Online File Access Using Audit Logs
Question details
The user needs to track who accesses individual documents or videos in SharePoint Online, including identifying the users and viewing access timestamps.

- Product
- SharePoint Online
- Device & OS
- not provided
- Scenario
- Monitoring user access and file interaction metrics for specific files hosted in a SharePoint library.
- Observed behavior
- SharePoint Online does not natively support direct tracking of individual files via Google Analytics, requiring alternative methods like Microsoft Purview audit logs or intermediate landing pages.
Ensure you have the necessary administrator permissions in the Microsoft Purview compliance portal to access and run audit log searches for your organization.
Use Microsoft Purview Audit Logs
This is the recommended and most efficient native method to track file access securely across your entire SharePoint environment.
Microsoft Purview automatically records file activity in SharePoint. Instead of modifying individual files, administrators can query these logs to see exactly who accessed a document and when.
Log in to the Microsoft Purview compliance portal using your administrator credentials.
On the left navigation pane, select 'Audit' to open the audit log search tool.
Set the Date and time range. Under 'Activities', select file and page activities such as 'Accessed file' or 'Downloaded file'. Enter the specific SharePoint site or file URL in the 'File, folder, or site' field.
Click 'Search' to generate the log. Once the search completes, click 'Export' to download the results as a CSV file for detailed analysis.

Create SharePoint Landing Pages with Tracking Code
Best for application-level analytics where external tracking tools like Google Analytics are strictly required.
Analyze Your SharePoint Audit Logs with WPS Office
After exporting your SharePoint file access data, use WPS Spreadsheet to filter, analyze, and visualize your audit logs. WPS Office is a free, lightweight suite that offers comprehensive tools for handling large CSV exports and creating complex data reports seamlessly.
- 1. Download and Install: Get WPS Office for free from the official website and install it on your device.
- 2. Open Your Exported Data: Launch WPS Spreadsheet and open the CSV audit log file you exported from Microsoft Purview.
- 3. Analyze the Data: Use Data Filters or insert a PivotTable to quickly sort users, access times, and specific file interactions.

Frequently Asked Questions
Can I directly add Google Analytics to a SharePoint document?
No, SharePoint Online does not allow the direct embedding of Google Analytics code into individual documents or files. You must use intermediate landing pages or rely on native Microsoft Purview audit logs.
What information is captured in a SharePoint audit log?
Audit logs capture comprehensive details including the user who accessed the file, the specific file name and path, the exact timestamp of access, and the user's IP address.
How far back can I track file access in Microsoft Purview?
By default, Microsoft Purview retains audit log records for 180 days for users with standard licenses. Organizations with advanced Microsoft 365 compliance licenses may extend this retention period up to one year or more.
How can I analyze the exported audit logs?
Once exported as a CSV file, you can open the data in spreadsheet software like WPS Spreadsheet or Microsoft Excel to filter the data, create PivotTables, or connect it to Power BI for advanced dashboard visualizations.




