Title: Custom Data
Last modified: August 21, 2016

---

# Custom Data

 *  Resolved [rrichardson](https://wordpress.org/support/users/rrichardson/)
 * (@rrichardson)
 * [13 years ago](https://wordpress.org/support/topic/custom-data/)
 * How do I enter my own custom data from my site – intercom shows this
 * window.intercomSettings = {
    … // TODO: Add any extra data you want in Intercom
   to your intercomSettings ‘avatar_set’ : true, ‘friend_count’ : 32, app_id: ‘860bc89a47d99dd97b5b3abb7e846ee53d79837f’}
 * But using the plugin, how can I do that?
 * [http://wordpress.org/extend/plugins/intercom-for-wordpress/](http://wordpress.org/extend/plugins/intercom-for-wordpress/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Simon Blackbourn](https://wordpress.org/support/users/lumpysimon/)
 * (@lumpysimon)
 * [13 years ago](https://wordpress.org/support/topic/custom-data/#post-3734690)
 * There is a filter called `ll_intercom_custom_data` (see line 224) which allows
   you to filter the `$custom` array.
 * So for example if you store the user’s country in the usermeta table, you could
   add something like this to your functions.php file:
 *     ```
       add_filter( 'll_intercom_custom_data', 'my_intercom_custom_data' );
   
       function my_intercom_custom_data( $custom ) {
   
           $user_id  = get_current_user_id();
           $country  = get_user_meta( $user_id, 'country', true );
           $custom[] = '"Country":"' . $country . '"';
   
           return $custom;
   
       }
       ```
   
 * If you’re not familiar with WordPress filters, see [this page](http://codex.wordpress.org/Plugin_API)
   in the Codex.
 * The important thing is the format of the elements in the `$custom` array:
    - For strings it should be `"key":"value"` (note the two sets of double quotes).
    - For integers it should be `"key":value` (only one set of quotes).
 *  Plugin Author [Simon Blackbourn](https://wordpress.org/support/users/lumpysimon/)
 * (@lumpysimon)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/custom-data/#post-3734761)
 * Just to let you know that in the new version of Intercom for WordPress the `ll_intercom_custom_data`
   filter has changed slightly, due to a change in the Intercom API.
 * It’s now a straightforward array of key/value pairs, there’s no need to insert
   colons and quotes. Here’s how you should now do the above code:
 *     ```
       add_filter( 'll_intercom_custom_data', 'my_intercom_data' );
   
       function my_intercom_data( $custom ) {
   
       	$user_id = get_current_user_id();
   
       	if ( $country = get_user_meta( $user_id, 'country', true ) ) {
       		$custom['Country'] = $country;
       	}
   
       	return $custom;
   
       }
       ```
   
 * Sorry it’s no longer backwards compatible, but I had to make this change to ensure
   the plugin continues to work in the future.
 * Simon

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Custom Data’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/intercom-for-wordpress_e3f7ff.svg)
 * [Intercom for WordPress](https://wordpress.org/plugins/intercom-for-wordpress/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/intercom-for-wordpress/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/intercom-for-wordpress/)
 * [Active Topics](https://wordpress.org/support/plugin/intercom-for-wordpress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/intercom-for-wordpress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/intercom-for-wordpress/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Simon Blackbourn](https://wordpress.org/support/users/lumpysimon/)
 * Last activity: [12 years, 8 months ago](https://wordpress.org/support/topic/custom-data/#post-3734761)
 * Status: resolved