Skip to content
This repository was archived by the owner on Jun 10, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## Version 2.3.0-beta1
- Updated Javascript Snippet with latest from [Github/ApplicationInsights-JS](https://github.com/Microsoft/ApplicationInsights-JS)

## Version 2.2.1
- Updated Web/Base SDK version dependency to 2.5.1 which addresses a bug.

Expand Down
21 changes: 10 additions & 11 deletions src/Microsoft.ApplicationInsights.AspNetCore/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -121,17 +121,16 @@
<value>appInsights.setAuthenticatedUserContext("{0}");</value>
</data>
<data name="JavaScriptSnippet" xml:space="preserve">
<value> &lt;script type="text/javascript"&gt;
var appInsights=window.appInsights||function(config){{
function i(config){{t[config]=function(){{var i=arguments;t.queue.push(function(){{t[config].apply(t,i)}})}}}}var t={{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&amp;&amp;f(config,i,u,e,o);return s!==!0&amp;&amp;t["_"+r](config,i,u,e,o),s}}),t
}}({{
instrumentationKey: '{0}'
}});
<value>&lt;script type="text/javascript"&gt;

var appInsights=window.appInsights||function(a){{
function b(a){{c[a]=function(){{var b=arguments;c.queue.push(function(){{c[a].apply(c,b)}})}}}}var c={{config:a}},d=document,e=window;setTimeout(function(){{var b=d.createElement("script");b.src=a.url||"https://az416426.vo.msecnd.net/scripts/a/ai.0.js",d.getElementsByTagName("script")[0].parentNode.appendChild(b)}});try{{c.cookie=d.cookie}}catch(a){{}}c.queue=[];for(var f=["Event","Exception","Metric","PageView","Trace","Dependency"];f.length;)b("track"+f.pop());if(b("setAuthenticatedUserContext"),b("clearAuthenticatedUserContext"),b("startTrackEvent"),b("stopTrackEvent"),b("startTrackPage"),b("stopTrackPage"),b("flush"),!a.disableExceptionTracking){{f="onerror",b("_"+f);var g=e[f];e[f]=function(a,b,d,e,h){{var i=g&amp;&amp;g(a,b,d,e,h);return!0!==i&amp;&amp;c["_"+f](a,b,d,e,h),i}}}}return c
}}({{
instrumentationKey: '{0}'
}});

window.appInsights=appInsights;
appInsights.trackPageView();
{1}
&lt;/script&gt;
</value>
window.appInsights=appInsights,appInsights.queue&amp;&amp;0===appInsights.queue.length&amp;&amp;appInsights.trackPageView();
{1}
&lt;/script&gt;</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static void SnippetWillNotIncludeAuthUserNameIfEnabledAndAuthenticated()
string unittestkey = "unittestkey";
var telemetryConfiguration = new TelemetryConfiguration { InstrumentationKey = unittestkey };
var snippet = new JavaScriptSnippet(telemetryConfiguration, GetOptions(true), GetHttpContextAccessor("username", false), encoder);
Assert.DoesNotContain("setAuthenticatedUserContext", snippet.FullScript);
Assert.DoesNotContain("appInsights.setAuthenticatedUserContext(", snippet.FullScript);
}

[Fact]
Expand Down