Repository URL to install this package:
|
Version:
1.0.0-alpha.7 ▾
|
import { getSystemType } from './getSystemType';
const { NODE_ENV, DOODLE_ENV } = process.env;
/**
* Collect basic page and environment data for Google Analytics
*
* @param {?Object} trackingData - An object created by getTrackingDataObject function
* @param {?Object} trackingData.pageType - An object produced by getTrackingDataObject function
* @return {undefined}
*/
const getBasicAnalyticsData = ({ pageType } = {}) => ({
page: {
...(pageType && { pageType }),
viewportHeight: window.innerHeight || 0,
viewportWidth: window.innerWidth || 0,
},
environment: {
systemType: getSystemType({ NODE_ENV, DOODLE_ENV }),
},
});
export { getBasicAnalyticsData };