I have a basic .html page with the following code below. I'm using my real Instrumentation Key (not xxx) which I have setup for my Application Insights monitoring environment. Looks like it initializes successfully with no errors. However, I can't see any Incoming Requests, data, etc. (Live metrics, Performance).
NOTE: I do use this same Application Insights monitoring environment setup on Azure Portal for separate vb.NET websites/projects (those projects use NuGet packages) with no problems seeing incoming data. However, my static .html and .asp pages are grouped in a separate website within solution with no NuGet packages...just this script directly in example static page.
I retrieved example here --> https://github.com/Microsoft/ApplicationInsights-node.js/
<script type="text/javascript" src="https://js.monitor.azure.com/scripts/b/ai.2.min.js"></script>
<script type="text/javascript">
var snippet = {
config: {
instrumentationKey: "xxx"
}
};
var init = new Microsoft.ApplicationInsights.ApplicationInsights(snippet);
var appInsights = init.loadAppInsights();
//appInsights.trackPageView();
//---- Send Telemetry to Azure Portal
//appInsights.trackEvent({ name: 'some event' });
appInsights.trackEvent({
name: 'some event',
properties: { // accepts any type
prop1: 'string',
prop2: 123.45,
prop3: { nested: 'objects are okay too' }
}
});
appInsights.trackPageView({ name: 'some page' });
appInsights.trackPageViewPerformance({ name: 'some page', url: 'some url' });
appInsights.trackException({ exception: new Error('some error') });
//appInsights.trackTrace({ message: 'some trace' });
var telemetryInitializer = (envelope) => {
envelope.data.someField = 'This item passed through my telemetry initializer';
};
appInsights.addTelemetryInitializer(telemetryInitializer);
appInsights.trackTrace({ message: 'This message will use a telemetry initializer' });
appInsights.trackMetric({ name: 'some metric', average: 42 });
appInsights.trackDependencyData({ absoluteUrl: 'some url', responseCode: 200, method: 'GET', id: 'some id' });
appInsights.startTrackPage("pageName");
appInsights.stopTrackPage("pageName", null, { customProp1: "some value" });
appInsights.startTrackEvent("event");
appInsights.stopTrackEvent("event", null, { customProp1: "some value" });
appInsights.flush();
</script>