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

feat: Mobile device model support #425

Merged
merged 6 commits into from
Sep 8, 2021
Merged
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@
},
"main": "amplitude.umd.js",
"dependencies": {
"@amplitude/ua-parser-js": "0.7.24",
"@amplitude/ua-parser-js": "0.7.25",
"@amplitude/utils": "^1.0.5",
"blueimp-md5": "^2.10.0",
"query-string": "5"
4 changes: 3 additions & 1 deletion src/amplitude-client.js
Original file line number Diff line number Diff line change
@@ -1260,7 +1260,8 @@ AmplitudeClient.prototype._logEvent = function _logEvent(

const osName = this._ua.browser.name;
const osVersion = this._ua.browser.major;
const deviceModel = this._ua.os.name;
const deviceModel = this._ua.device.model || this._ua.os.name;
const deviceVendor = this._ua.device.vendor;

userProperties = userProperties || {};
var trackingOptions = { ...this._apiPropertiesTrackingOptions };
@@ -1280,6 +1281,7 @@ AmplitudeClient.prototype._logEvent = function _logEvent(
os_name: _shouldTrackField(this, 'os_name') ? osName || null : null,
os_version: _shouldTrackField(this, 'os_version') ? osVersion || null : null,
device_model: _shouldTrackField(this, 'device_model') ? deviceModel || null : null,
device_manufacturer: _shouldTrackField(this, 'device_manufacturer') ? deviceVendor || null : null,
language: _shouldTrackField(this, 'language') ? this.options.language : null,
api_properties: apiProperties,
event_properties: utils.truncate(utils.validateProperties(eventProperties)),
250 changes: 125 additions & 125 deletions test/ua-parser.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
@@ -15,10 +15,10 @@
resolved "https://registry.yarnpkg.com/@amplitude/types/-/types-1.0.4.tgz#21275b030c8267f9ea133a79c5c525e30c706d69"
integrity sha512-iWdgTXiE0T/QCK88g2ezJEhJpYHDvDs0StVVPu1ygcl6qYzk/8xrNvbeEibiIBT8t/GJ8FtH5ZIPx3c4CMjlig==

"@amplitude/ua-parser-js@0.7.24":
version "0.7.24"
resolved "https://registry.yarnpkg.com/@amplitude/ua-parser-js/-/ua-parser-js-0.7.24.tgz#2ce605af7d2c38d4a01313fb2385df55fbbd69aa"
integrity sha512-VbQuJymJ20WEw0HtI2np7EdC3NJGUWi8+Xdbc7uk8WfMIF308T0howpzkQ3JFMN7ejnrcSM/OyNGveeE3TP3TA==
"@amplitude/ua-parser-js@0.7.25":
version "0.7.25"
resolved "https://registry.yarnpkg.com/@amplitude/ua-parser-js/-/ua-parser-js-0.7.25.tgz#ccbeb0bd24fca3759cfc09a3b9ba95a23ea32756"
integrity sha512-AUeO9T6vLkUNw0iYxchFBw3FylJAMv5g2sPUsS5XCulAP3TpZg9Y/QESOl+oCLGqTQYumUJZHfoQBemN22eghw==

"@amplitude/utils@^1.0.5":
version "1.0.5"