Create customizable parameter for Application Insights

4

In a WebForms project (C # - .NET 4.6.2) I'm using Azure's Application Insights telemetry I'd like to send a custom parameter to the statistic. / p>

I basically want to send the ClientId to the telemetry, so I would know to identify some bottlenecks.

Todayitpresentsthisdata,Iwouldliketosendacustomone,ifitdoesnotexist,IwillhavetosendviaQuerystringtheClientIdbutIdonotwanttooptforthispathasitwillgiveahugejob,aswellasconsidergambiarra.

I'musingJavaScriptintheMasterPagetrackingcode,somethinglike:

varappInsights=window.appInsights||function(config){functioni(config){t[config]=function(){vari=arguments;t.queue.push(function(){t[config].apply(t,i)})}}vart={config:config},u=document,e=window,o="script",s="AuthenticatedUserContext",h="start",c="stop",l="Track",a=l+"Event",v=l+"Page",y=u.createElement(o),r,f;y.src=config.url||"https://az416426.vo.msecnd.net/scripts/a/ai.0.js";u.getElementsByTagName(o)[0].parentNode.appendChild(y);try{t.cookie=u.cookie}catch(p){}for(t.queue=[],t.version="1.0",r=["Event","Exception","Metric","PageView","Trace","Dependency"];r.length;)i("track"+r.pop());return i("set"+s),i("clear"+s),i(h+a),i(c+a),i(h+v),i(c+v),i("flush"),config.disableExceptionTracking||(r="onerror",i("_"+r),f=e[r],e[r]=function(config,i,u,e,o){var s=f&&f(config,i,u,e,o);return s!==!0&&t["_"+r](config,i,u,e,o),s}),t
    }({
        instrumentationKey:"minha key"
    });
    
asked by anonymous 30.01.2017 / 11:59

1 answer

2

In addition to instrumentationKey you can pass some other information, among them:

appUserId: string
accountId: string

If you play the ClientId value in appUserId you will be able to see this information in Application Insights

More information at: link

    
14.03.2017 / 21:50