SugarCRM Developers on Twitter

HOWTO: Add IP Address in Campaign Web Tracking URLs

Editor’s Note: This blog posts comes directly from a forums post by Sugar Community Member David Beecher, who is a Sr. Solutions Architect and Integration Specialist at TekOps. He details an easy to do customization that although is not upgrade-safe, is useful in tracking the IP addresses from those viewing your campaign emails.

It is easy enough to set up a campaign with tracking URLs so that is not discussed here. However, the only thing that get’s logged to the campaign_log table is that an event occurred and the date and time. You don’t get any information about the user.

That is unfortunate. It leaves you with nothing to work with.

With one simple line you can add the link clicker’s IP address.

This works in SugarCRM 6.2.4
Go to the file: modules/Campaigns/utils.php
Open the file and go to line 177 and add the following AFTER that line:

Now you will get the user’s IP address and might be able to tie that into an analytics system to identify who/what/when.

Caveats:
If you have reverse dns turned off on your webserver for performance the REMOTE_HOST part will be blank. This can be solved by a call to gethostbyaddr() but that can cause serious delays in your CRM with DNS timeouts.