Expand my Community achievements bar.

SOLVED

DTM - How to use Client IP address as a rule condition

Avatar

Level 2

I'd like to know how to use the client's IP address as a rule condition in DTM.  I'd like to be able to include or exclude based on IP address using regular expressions for matching.  Is there a clean way to do this? 

 

Thanks, 

-Stew

1 Accepted Solution

Avatar

Correct answer by
Level 3

Stew,

Unfortunately IP address is not exposed directly in the browser via HTML/Javascript for security reasons. The only way that DTM could use IP address is if your site actually set the user's IP address in a Javascript variable on every page, or if you used an AJAX call to an outside server to get this information.  The latter of these is not the preferred option given that it adds additional latency to the processing of your DTM rules (because it has to wait for the remote server to respond), but on the plus side it is something that you would be able to implement and try out without involving your IT department to update the code on the page.

Here's a link to check out with some ideas on how this might be done (note that this is an external site so none of the code has been vetted/tested by Adobe):
http://stackoverflow.com/questions/391979/get-client-ip-using-just-javascript

Hope this helps!

Best,
Shawn

View solution in original post

1 Reply

Avatar

Correct answer by
Level 3

Stew,

Unfortunately IP address is not exposed directly in the browser via HTML/Javascript for security reasons. The only way that DTM could use IP address is if your site actually set the user's IP address in a Javascript variable on every page, or if you used an AJAX call to an outside server to get this information.  The latter of these is not the preferred option given that it adds additional latency to the processing of your DTM rules (because it has to wait for the remote server to respond), but on the plus side it is something that you would be able to implement and try out without involving your IT department to update the code on the page.

Here's a link to check out with some ideas on how this might be done (note that this is an external site so none of the code has been vetted/tested by Adobe):
http://stackoverflow.com/questions/391979/get-client-ip-using-just-javascript

Hope this helps!

Best,
Shawn