Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JS SDK: stopped collecting screen resolution and locale by default #5

Open
MaxShehovtsov opened this issue Dec 14, 2015 · 1 comment

Comments

@MaxShehovtsov
Copy link

To enable the collection please use telemetry initializers. This code needs to be in your snippet right after the initialization and before appInsights.trackPageView(...):

    appInsights.queue.push(function () {
        appInsights.context.addTelemetryInitializer(function (envelope) {
            envelope.tags = envelope.tags || {};
            if (typeof screen !== "undefined") {
                envelope.tags["ai.device.screenResolution"] = screen.width + "X" + screen.height;
                envelope.tags["ai.device.locale"] = navigator.language || navigator.browserLanguage || "unknown";
            }
        });
    });
@SergeyKanzhelev
Copy link

It was deprecated as a standard dimension in backend.

You can place screen resolution into custom properties of an event:

appInsights.queue.push(function () {
    appInsights.context.addTelemetryInitializer(function (envelope) {
        var telemetryItem = envelope.data.baseData;
        if (typeof screen !== "undefined") {
            telemetryItem.properties = telemetryItem.properties || {};
            telemetryItem.properties["ai.device.screenResolution"] = screen.width + "X" + screen.height;
            telemetryItem.properties["ai.device.locale"] = navigator.language || navigator.browserLanguage || "unknown";
        }
    });
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants