Hi @frob ,
Do you want to use PowerShell to query SharePoint Online audit data and retrieve total and unique visitors for the past 90 days?
Here's an example code snippet that demonstrates this:
Please adjust the date in the code:$startDate = (Get-Date).AddDays(-90)
$endDate = Get-Date
Please note that although the cmdlet is part of the Exchange Online Management Shell, it can be used to retrieve audit logs for SharePoint Online as well
Here is link for your reference:
SharePoint Online: How to View Audit Log Reports in Security & Compliance Center? - SharePoint Diary
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best Regards
Cheng Feng