Skip to content

Commit bdd215f

Browse files
committed
Fix get_random_device_type() to match OrderAttributionMeta::get_device_type() possible return value.
1 parent 280c813 commit bdd215f

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

includes/Generator/OrderAttribution.php

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -222,26 +222,19 @@ public static function get_source( $source_type ) {
222222
/**
223223
* Get random device type based on the following distribution:
224224
* Mobile: 50%
225-
* Desktop: 30%
226-
* Tablet: 10%
227-
* Unknown: 10%
225+
* Desktop: 35%
226+
* Tablet: 15%
228227
*/
229228
public static function get_random_device_type() {
230229
$randomNumber = wp_rand( 1, 100 ); // Generate a random number between 1 and 100.
231230

232231
if ( $randomNumber <= 50 ) {
233232
return 'Mobile';
234-
}
235-
236-
if ( $randomNumber <= 80 ) {
233+
} elseif ( $randomNumber <= 85 ) {
237234
return 'Desktop';
238-
}
239-
240-
if ( $randomNumber <= 90 ) {
235+
} else {
241236
return 'Tablet';
242237
}
243-
244-
return 'Unknown';
245238
}
246239

247240
/**

0 commit comments

Comments
 (0)