Deeper analytics for Azure Static Web Apps?
D

1

8

Is it possible to access analytics such as browser, dates and times of site hits, IP addresses, etc.?

From the docs here, it looks like Azure App Insights are only available for Static Web Apps that use Azure Functions. I just have a static website, no API's.

Here is the message I'm shown when trying to enable App Insights: enter image description here

Ideally, I want to set a Diagnostic Setting and use Azure Log Analytics to view analytics.

How can I get deeper analytics on a Static Web App without a Function API?

EDIT 1: I'd like to at least capture the number of hits somewhere.

  • Azure Metrics is grabbing them, but doesn't seem to expose logs anywhere, only these visualizations.

enter image description here

Dresser answered 26/6, 2021 at 21:43 Comment(4)
I'm not sure if azure app insights can meet all your analytic requirement, but if you are deploying a static web app written by angular,react, etc, you may use code-based method to integrate app insights, see learn.microsoft.com/en-us/azure/azure-monitor/app/… Hence, could you pls add more details on your static web app? I mean how you writing your app, which framework is used...Surf
I believe its a javascript tool. Its a turnkey site, so minimal dev required. Squido static blog.Dresser
@TinyWang, do you know how to get to the raw Azure Metric data logs as shown in EDIT 1 above?Dresser
SiteHits seems to be a custom metric, and you can see my test i.sstatic.net/Hu8p8.png How to add trackmetric:learn.microsoft.com/en-us/azure/azure-monitor/app/…Surf
D
3

Ended up going with:

  • A stand-alone Application Insights instance
    • Azure Static Apps does not allow App Insights to be turned on for the resource unless there is an Azure Function involved(?)
  • Added this App Insights Javascript snippet to each page of the static site.

Got some great help from @MSNEV!

This is the solution I was looking for.

Dresser answered 1/7, 2021 at 4:55 Comment(2)
I also have the same problem... I tried adding one dummy api function, then I was able to deploy appinsights. Still, this seems to only track api related requests, no GET requests for the static sites... A well I might just go with standalone storage static site hosting.Frontage
The JavaScript snippet above works well without have to deploy a dummy function.Dresser

© 2022 - 2024 — McMap. All rights reserved.