Skip to content

Commit

Permalink
Merge pull request #423 from MindscapeHQ/sh/add-viewport-to-sessions
Browse files Browse the repository at this point in the history
Add viewport dimension values to RUM session data
  • Loading branch information
Samuel Holt authored Sep 8, 2021
2 parents 3c07dc1 + f002573 commit 9b93586
Show file tree
Hide file tree
Showing 10 changed files with 276 additions and 75 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
* v2.24.0
- Send the browser's viewport width and height with each RUM session payload.

* v2.23.0
- If `ignore3rdPartyErrors` option is true, discard errors that match the pattern of errors from browser extensions, bots and crawlers
- If `ignore3rdPartyErrors` option is true, discard errors that match the pattern of errors from browser extensions, bots and crawlers.

* v2.22.5
- Fixes an issue with Core Web Vital tracking not being able to be disabled.
Expand Down
3 changes: 3 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ module.exports = function(grunt) {
'src/raygun.utilities/index.js',
'src/raygun.utilities/errorUtilities.js',
'src/raygun.network-tracking.js',
'src/raygun.viewport.js',
'src/raygun.breadcrumbs.js',
'src/raygun.rum/core-web-vitals.js',
'src/raygun.js',
Expand All @@ -44,6 +45,7 @@ module.exports = function(grunt) {
'src/raygun.utilities/index.js',
'src/raygun.utilities/errorUtilities.js',
'src/raygun.network-tracking.js',
'src/raygun.viewport.js',
'src/raygun.breadcrumbs.js',
'src/raygun.rum/core-web-vitals.js',
'src/raygun.js',
Expand All @@ -60,6 +62,7 @@ module.exports = function(grunt) {
'src/raygun.utilities/index.js',
'src/raygun.utilities/errorUtilities.js',
'src/raygun.network-tracking.js',
'src/raygun.viewport.js',
'src/raygun.breadcrumbs.js',
'src/raygun.rum/core-web-vitals.js',
'src/raygun.js',
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "raygun4js",
"version": "2.23.0",
"version": "2.24.0",
"homepage": "http://raygun.io",
"authors": [
"Mindscape <[email protected]>"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
],
"title": "Raygun4js",
"description": "Raygun.com plugin for JavaScript",
"version": "2.23.0",
"version": "2.24.0",
"homepage": "https://github.com/MindscapeHQ/raygun4js",
"author": {
"name": "MindscapeHQ",
Expand Down
2 changes: 1 addition & 1 deletion raygun4js.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>raygun4js</id>
<version>2.23.0</version>
<version>2.24.0</version>
<title>Raygun4js</title>
<authors>Mindscape Limited</authors>
<owners>Mindscape Limited</owners>
Expand Down
18 changes: 12 additions & 6 deletions src/raygun.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* Licensed under the MIT license.
*/

/*globals __DEV__, raygunUtilityFactory, raygunErrorUtilitiesFactory, raygunBreadcrumbsFactory, raygunNetworkTrackingFactory, raygunCoreWebVitalFactory */
/*globals __DEV__, raygunUtilityFactory, raygunErrorUtilitiesFactory, raygunBreadcrumbsFactory, raygunNetworkTrackingFactory, raygunViewportFactory, raygunCoreWebVitalFactory */

var raygunFactory = function(window, $, undefined) {
var Raygun = {};
Expand All @@ -19,6 +19,7 @@ var raygunFactory = function(window, $, undefined) {
Raygun.NetworkTracking = raygunNetworkTrackingFactory(window, Raygun);
Raygun.Breadcrumbs = raygunBreadcrumbsFactory(window, Raygun);
Raygun.CoreWebVitals = raygunCoreWebVitalFactory(window);
Raygun.Viewport = raygunViewportFactory(window, document, Raygun);

// Constants
var ProviderStates = {
Expand All @@ -43,6 +44,7 @@ var raygunFactory = function(window, $, undefined) {
_wrapAsynchronousCallbacks = false,
_automaticPerformanceCustomTimings = false,
_trackCoreWebVitals = true,
_trackViewportDimensions = true,
_customData = {},
_tags = [],
_user,
Expand Down Expand Up @@ -124,6 +126,7 @@ var raygunFactory = function(window, $, undefined) {
_captureMissingRequests = options.captureMissingRequests || false;
_automaticPerformanceCustomTimings = options.automaticPerformanceCustomTimings || false;
_trackCoreWebVitals = options.trackCoreWebVitals === undefined ? true : options.trackCoreWebVitals;
_trackViewportDimensions = options.trackViewportDimensions === undefined ? true : options.trackViewportDimensions;

if (options.apiUrl) {
_raygunApiUrl = options.apiUrl;
Expand Down Expand Up @@ -509,7 +512,8 @@ var raygunFactory = function(window, $, undefined) {
_setCookieAsSecure,
_captureMissingRequests,
_automaticPerformanceCustomTimings,
_trackCoreWebVitals
_trackCoreWebVitals,
_trackViewportDimensions
);
_rum.attach();
};
Expand Down Expand Up @@ -813,9 +817,11 @@ var raygunFactory = function(window, $, undefined) {
options.tags.push('React Native');
}

var viewportDimensions = Raygun.Viewport.getViewportDimensions();

var screenData = window.screen || {
width: Raygun.Utilities.getViewPort().width,
height: Raygun.Utilities.getViewPort().height,
width: viewportDimensions.width,
height: viewportDimensions.height,
colorDepth: 8,
};

Expand Down Expand Up @@ -883,8 +889,8 @@ var raygunFactory = function(window, $, undefined) {
'Document-Mode': !Raygun.Utilities.isReactNative()
? document.documentMode
: 'Not available',
'Browser-Width': Raygun.Utilities.getViewPort().width,
'Browser-Height': Raygun.Utilities.getViewPort().height,
'Browser-Width': viewportDimensions.width,
'Browser-Height': viewportDimensions.height,
'Screen-Width': screenData.width,
'Screen-Height': screenData.height,
'Color-Depth': screenData.colorDepth,
Expand Down
Loading

0 comments on commit 9b93586

Please sign in to comment.