@@ -34,8 +34,11 @@ public static void main(String[] args) throws IOException {
3434 String recaptchaSiteKey = "recaptcha-site-key" ;
3535 String token = "action-token" ;
3636 String recaptchaAction = "action-name" ;
37+ String userIpAddress = "user-ip-address" ;
38+ String userAgent = "user-agent" ;
39+ String ja3 = "ja3"
3740
38- createAssessment (projectID , recaptchaSiteKey , token , recaptchaAction );
41+ createAssessment (projectID , recaptchaSiteKey , token , recaptchaAction , userIpAddress , userAgent , ja3 );
3942 }
4043
4144 /**
@@ -47,9 +50,12 @@ public static void main(String[] args) throws IOException {
4750 * services. (score/ checkbox type)
4851 * @param token : The token obtained from the client on passing the recaptchaSiteKey.
4952 * @param recaptchaAction : Action name corresponding to the token.
53+ * @param userIpAddress: IP address of the user sending a request.
54+ * @param userAgent: User agent is included in the HTTP request in the request header.
55+ * @param ja3: JA3 associated with the request.
5056 */
5157 public static void createAssessment (
52- String projectID , String recaptchaSiteKey , String token , String recaptchaAction )
58+ String projectID , String recaptchaSiteKey , String token , String recaptchaAction , String userIpAddress , String userAgent , String ja3 )
5359 throws IOException {
5460 // Initialize client that will be used to send requests. This client only needs to be created
5561 // once, and can be reused for multiple requests. After completing all of your requests, call
@@ -58,7 +64,13 @@ public static void createAssessment(
5864 try (RecaptchaEnterpriseServiceClient client = RecaptchaEnterpriseServiceClient .create ()) {
5965
6066 // Set the properties of the event to be tracked.
61- Event event = Event .newBuilder ().setSiteKey (recaptchaSiteKey ).setToken (token ).build ();
67+ Event event = Event .newBuilder ()
68+ .setSiteKey (recaptchaSiteKey )
69+ .setToken (token )
70+ .setUserIpAddress (userIpAddress )
71+ .setJa3 (ja3 )
72+ .setUserAgent (userAgent )
73+ .build ();
6274
6375 // Build the assessment request.
6476 CreateAssessmentRequest createAssessmentRequest =
0 commit comments