7

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

SeaDude
  • 3,725
  • 6
  • 31
  • 68
  • 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 https://learn.microsoft.com/en-us/azure/azure-monitor/app/javascript#adding-the-javascript-sdk Hence, could you pls add more details on your static web app? I mean how you writing your app, which framework is used... – Tiny Wang Jun 28 '21 at 01:40
  • I believe its a javascript tool. Its a turnkey site, so minimal dev required. [Squido](https://docs.squido.org) static blog. – SeaDude Jun 28 '21 at 03:14
  • @TinyWang, do you know how to get to the raw Azure Metric data logs as shown in **EDIT 1** above? – SeaDude Jun 28 '21 at 04:07
  • 2
    `SiteHits` seems to be a [custom metric](https://carldesouza.com/how-to-create-custom-events-metrics-traces-in-azure-application-insights-using-c/), and you can see my test https://i.stack.imgur.com/Hu8p8.png How to add trackmetric:https://learn.microsoft.com/en-us/azure/azure-monitor/app/api-custom-events-metrics#single-values – Tiny Wang Jun 28 '21 at 06:31

1 Answers1

2

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.

SeaDude
  • 3,725
  • 6
  • 31
  • 68
  • 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. – baouss Jan 16 '22 at 13:28
  • The JavaScript snippet above works well without have to deploy a dummy function. – SeaDude Jan 27 '23 at 05:32