HOWTO: Add IP Address in Campaign Web Tracking URLs

sugarcrmdevelopers —  December 14, 2011 — 3 Comments

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:

$data['more_information']="'" . $_SERVER['REMOTE_ADDR'] .
                        " [" . $_SERVER['REMOTE_HOST']  . "]" . "'";

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.

3 responses to HOWTO: Add IP Address in Campaign Web Tracking URLs

  1. 

    Very useful information! Thank you for posting.

  2. 

    thank you…!!!!!!!!!!!!!!!
     

Trackbacks and Pingbacks:

  1. Add IP Address in Campaign Web Tracking URLs - SugarCRM Forums - December 15, 2011

    […] […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s