- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
01-08-2020 04:24 AM
Hi there,
We would like to capture the IP Address of our customer and send that information on GA as a customer dimension. How can we collect that data on a variable?
Many thanks
01-10-2020 06:51 AM
Hi @cristinaBmind ,
This would be one possible approach, using any API provider on the market. There are quite a few options, some free, some with limitations specially the free ones, some other payed ones.
See this list of examples:
https://stackoverflow.com/questions/391979/how-to-get-clients-ip-address-using-javascript
Once you decided with which vendor to go, here is a list of steps:
EX:
utag.link({ event_name : "client_ip", ip_address : {{data with ip returned from the vendor call}} })
with this in place, we can then catch the "client_ip" event and send it to any vendor, in your case GA.
07-18-2020 04:27 AM
const Http = new XMLHttpRequest(); const url9="https://api.ipify.org/?format=text"; Http.open("GET", url9) Http.send(); Http.onreadystatechange = (e) => { console.log(Http.responseText) console.log("ipify call sucesesful") var ip_address_ipify = (Http.responseText) utag_data.ip_address_ipify=ip_address_ipify; }
Copyright All Rights Reserved © 2008-2023