- Posts: 168
- Thank you received: 2
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Can I save part of an IP address?
- ymca
- Topic Author
- Offline
- Elite Member
Less
More
4 years 3 weeks ago #195883
by ymca
LS Version 4.2+
Can I save part of an IP address? was created by ymca
Hi,
Instead of saving the entire IP number, can I save just the start so I will not break the privacy laws?
I have seen in matomo that they can save just IP number of the country the users are coming from.
Can we do it in LimeSurvey?
Instead of saving the entire IP number, can I save just the start so I will not break the privacy laws?
I have seen in matomo that they can save just IP number of the country the users are coming from.
Can we do it in LimeSurvey?
LS Version 4.2+
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
4 years 3 weeks ago - 4 years 3 weeks ago #195896
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Can I save part of an IP address?
As far as I know, there is no way to detect the IP address directly with JavaScript but you should be able to make an AJAX call to a PHP script the returns the IP address and then parse that and load it into a short-text question.
Something like this in the source of the short-text:
And, maybe something like this in the PHP file but you should research this to see if there is a more secure method:
Something like this in the source of the short-text:
Code:
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ // Identify this question var thisQuestion = $('#question{QID}'); // AJAX call to the PHP file $.get('https://pathTo/returnIP.php', function(data) { // Create an array of the IP address character sets var ipArray = data.split('.'); // Load the text element with the first character set in the array $('input:text', thisQuestion).val(ipArray[0]); }); }); </script>
And, maybe something like this in the PHP file but you should research this to see if there is a more secure method:
Code:
<?php $ip = $_SERVER['REMOTE_ADDR']?:($_SERVER['HTTP_X_FORWARDED_FOR']?:$_SERVER['HTTP_CLIENT_IP']); echo $ip; ?>
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 4 years 3 weeks ago by tpartner.
The following user(s) said Thank You: ymca
The topic has been locked.
- ymca
- Topic Author
- Offline
- Elite Member
Less
More
- Posts: 168
- Thank you received: 2
4 years 3 weeks ago #195908
by ymca
LS Version 4.2+
Replied by ymca on topic Can I save part of an IP address?
Thanks.
How do they say? "It's above my pay grade."
I mean It's too difficult for me :S
Is it a "feature request-able" thing that I can post (an option that lets the survey creator choose if to collect full IP or part of it to the survey)?
How do they say? "It's above my pay grade."
I mean It's too difficult for me :S
Is it a "feature request-able" thing that I can post (an option that lets the survey creator choose if to collect full IP or part of it to the survey)?
LS Version 4.2+
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11639
- Thank you received: 2737
4 years 3 weeks ago #195916
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic Can I save part of an IP address?
Of course you can, but there are other feature requests that I would consider far more important waiting for years now, so I think chances are low that this will be implemented as a feature. Maybe someone creates a Plugin for it.Is it a "feature request-able" thing that I can post (an option that lets the survey creator choose if to collect full IP or part of it to the survey)?
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The following user(s) said Thank You: DenisChenu, ymca
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13597
- Thank you received: 2487
4 years 2 weeks ago #196002
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Can I save part of an IP address?
Plugin for LimeSurvey :
gitlab.com/SondagesPro/coreAndTools/matomoPublicTrack
Plugin for matomo : gitlab.com/SondagesPro/External/LimeSurveyUserProfile *
Plugin for matomo : gitlab.com/SondagesPro/External/LimeSurveyUserProfile *
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The following user(s) said Thank You: ymca
The topic has been locked.