Skip to content

Commit

Permalink
✨ Add bitness to User Agent Client Hint Params in ad requests (#35612)
Browse files Browse the repository at this point in the history
* Add User Agent Client Hint Params to Google Ads.

* Update the param names.

* Add timeout for UACH promise (1 second).

* Use fake timers for timeout test.

* Lint

* Add exception for dependency on promise.js.

* Add bitness field to User Agent Client Hints params

* Fix merge

* Fix merge again

* Lint
  • Loading branch information
zombifier committed Aug 12, 2021
1 parent 87d5d14 commit b6476c3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ads/google/a4a/test/test-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -649,13 +649,14 @@ describes.sandboxed('Google A4A utils', {}, (env) => {
architecture: 'x86',
model: 'Pixel',
uaFullVersion: 3.14159,
bitness: 42,
}),
},
});
return fixture.addElement(elem).then(() => {
return googleAdUrl(impl, '', Date.now(), [], []).then((url) => {
expect(url).to.match(
/[&?]uap=Windows&uapv=10&uaa=x86&uam=Pixel&uafv=3.14159[&$]/
/[&?]uap=Windows&uapv=10&uaa=x86&uam=Pixel&uafv=3.14159&uab=42[&$]/
);
});
});
Expand Down Expand Up @@ -684,7 +685,7 @@ describes.sandboxed('Google A4A utils', {}, (env) => {
const promise = googleAdUrl(impl, '', Date.now(), [], []).then(
(url) => {
expect(url).to.not.match(
/[&?]uap=Windows&uapv=10&uaa=x86&uam=Pixel&uafv=3.14159[&$]/
/[&?]uap=Windows&uapv=10&uaa=x86&uam=Pixel&uafv=3.14159&uab=42[&$]/
);
}
);
Expand Down
2 changes: 2 additions & 0 deletions ads/google/a4a/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ export function googlePageParameters(a4a, startTime) {
'uaa': uaDataValues?.architecture,
'uam': uaDataValues?.model,
'uafv': uaDataValues?.uaFullVersion,
'uab': uaDataValues?.bitness,
};
});
}
Expand Down Expand Up @@ -1198,5 +1199,6 @@ function getUserAgentClientHintParameters(win) {
'architecture',
'model',
'uaFullVersion',
'bitness',
]);
}

0 comments on commit b6476c3

Please sign in to comment.