Today in this tutorial we will know how to get visitor details like IP, Operating System and Web Application.
Important Note: This tutorial is for information purpose and I do not know about any legal use of this method. In case of violation to any policy kindly inform me on royal.rutik@gmail.com.
Step 1 : Add a reCAPTCHA element in your site's header. To get more help on this Click Here
Step 2 : Change reCAPTCHA element ID to "captcha" and click on collapsed on load from the element's property panel.
Step 3 : Create a New Web Module (visitor-info.jsw) at backend side.
Step 4 : Copy-Paste the below code into the Web Module.
import wixCaptchaBackend from 'wix-captcha-backend';
export function authorize_Captcha(token) {
return wixCaptchaBackend.authorize(token)
.catch((error) => {
let agent_info = JSON.parse(error.config.headers['x-wix-user-agent-info']);
let info = {
"user-ip-address": error.config.headers['x-real-ip'],
"user-application": agent_info.uaDetails.name,
"user-operating-system": agent_info.osDetails.name
}
return info;
});
}
Step 5 : Use the below function to get visitor details on any of the page of your website
import { authorize_Captcha } from 'backend/test';
$w.onReady(async function () {
let user_info = await authorize_Captcha($w('#captcha').token);
$w('#text1').text = user_info['user-ip-address'];
$w('#text2').text = user_info['user-application'];
$w('#text3').text = user_info['user-operating-system'];
});
In case of any queries or issues with this tutorial kindly contact at royal.rutik@gmail.com.
Please can I get the City info and also State?
Can I get country info with this method?
You should better place your TUTORIAL here....