Is this feasible in a javascript extension?

Gold Contributor
Gold Contributor

I want to grab a vistiors IP address and run it through an API (http://www.ipaddressapi.com) in order to map the data returned into some variables and map them into our analytics tool.

12 REPLIES 12

Is this feasible in a javascript extension?

Tealium Employee
Hi Joe, A users IP address cannot be picked up by our solution without some help. Being a client side solution, Tealium only has access to JavaScript and this prevents the solution from determining a users IP address. If you are able to capture the IP address server side (PHP, ASP, etc) and set the IP address in a utag_data variable, then you should be able to run the IP address through the API. At that point Tealium can take the output and map it to your analytics vendor. Please let me know if this answers your questions or if you need further clarification. Cheers, -Dan

Is this feasible in a javascript extension?

Gold Contributor
Gold Contributor
This is helpful, so when I get the IP into utag_data I should be good to go.

Is this feasible in a javascript extension?

Tealium Employee
That is correct.

Is this feasible in a javascript extension?

Employee Emeritus
I've got jQuery working in an Extension to do this. I scoped it to pre-load and this just alerts the visitor IP: $.getJSON("http://jsonip.appspot.com?callback=?", function(data){ alert("Your ip: " + data.ip); }); but this could easily be used to set a variable in the same manner. This variable can then be scoped to utag.data for use by Tealium. Caveats: REQUIRES JQUERY and you are relying on an external service to return this(appspot.com) value

Is this feasible in a javascript extension?

Gold Contributor
Gold Contributor
Thanks. I will have to play around with that a bit.

Is this feasible in a javascript extension?

Employee Emeritus
If you want to create some geo based variables, there are also some commercial services that you can use. For example http://dev.maxmind.com/geoip/javascript loads some variables with the user's country, city etc based on the IP address. You could easily incorporate that in a JS extension and set variables based on the data they return.

Is this feasible in a javascript extension?

Gold Contributor
Gold Contributor
Thanks Fiann. I am less interested in the GEO based info since we have some of that already via our analytics tool. I am more interested in the organizational information that can be harvested from the IP since we are a b2b.

Is this feasible in a javascript extension?

Bronze Contributor
Bronze Contributor
Yes, however I found that my Cloudflare CDN got in the way and caused MaxMind to incorrectly report the country.

Is this feasible in a javascript extension?

Bronze Contributor
Bronze Contributor

Hi I'm trying to do the same and am fairly new to Tealium. Can you help me navigate this. I first went into extensions tab and see this. What should I do next? where do I insert this code

 

 

$.getJSON("http://jsonip.appspot.com?callback=?", function(data){ alert("Your ip: " + data.ip);

 

Am I doing this correctly?

 

ip

Is this feasible in a javascript extension?

Employee Emeritus

Hello @Reena. Let me see if I can find someone to help! :-)

Remember to give me a kudo if you like my post! Accepting my post as a solution is even better! Also remember that search is your friend.

Is this feasible in a javascript extension?

Employee Emeritus

While we're waiting, @Reena, would you mind describing to me what you are trying to accomplish? Thank you and I look forward to your reply. 

Remember to give me a kudo if you like my post! Accepting my post as a solution is even better! Also remember that search is your friend.

Is this feasible in a javascript extension?

Employee Emeritus

@Reena This type of solution will have timing issues involoved.  You will be making a call out to a third party service and then the question becomes...  Are you wanting to delay sending data to your Tagging Vendors until after this data comes back?  Is this service one you can depend on?  A simple and more accurate approach would be to get this information from your web developer.  They can add this information to the Data Layer and now you do not have a timing issue and you are not dependant on a third party service.   Also make sure your company PII Privacy Policy allows you to capture your customer's IP address.  

Public