我正在我的web应用程序中使用Azure Application Insights。我想在第一个Application insights中跟踪一种类型的事件,在第二个Application Insight中跟踪第二种类型的活动。
是否可以使用客户端API在一个页面中使用Application Insights的两个检测密钥?
您可以基于2个不同的键初始化2个不同Application Insights对象
//first object initialization
var appInsights1=window.appInsights1||function(config){
......
instrumentationKey:"<key1>",
});
window.appInsights1 = appInsights1; //assigning to global variable
appInsights1.trackPageView(); //first object to track Pageview
//second object initialization
var appInsights2=window.appInsights2||function(config){
......
instrumentationKey:"<key2>",
});
window.appInsights2 = appInsights2; //assigning to global variable
appInsights2.trackException(ex); //second object to track Exception