Thank you! Your feedback has been delivered
Thank you! Your feedback has been sent

Intercom.io Javascript code integration to wordpress member site

I'm trying to install intercom.io JS script to my private members area. This is hosted on a wordpress site with the optimise press 2.0 theme.

The code will look like this:

window.intercomSettings = { name: current_user.name, email: current_user.email, created_at: current_user.signed_up_date, app_id: "your_app_id" };

I know how to install this code, but I can't get it to sync with all registered users using my members areas.

I'm hoping you can help me with this.

User Gravatar

RuAnderson

Posted Mar 27 2015 1:57 PDT

$50


  • Assigned To Remmy
  • Solved
  • javascript
    wordpress
    Intercom
  • 1316 Views

14 Replies


sdf

User Gravatar

jawittdesigns

Posted Mar 27 2015 3:35 PDT

Thanks for this information. I feel we are getting somewhere.

The bad news is I have zero coding experience, so I'm still not too sure what needs adding and to where.

Is this something you can help me with on my wordpress platform?

Ta, Ru

User Gravatar

RuAnderson

Posted Mar 27 2015 4:59 PDT

@RuAnderson You need to add tha php code inside wp-content/themes/{your-theme-folder}/functions.php

User Gravatar

JBNavadiya

Posted Mar 27 2015 5:45 PDT

Sure, but I'll have to charge you a sepperate development fee

User Gravatar

jawittdesigns

Posted Mar 27 2015 5:46 PDT

OK, so if I add that to the php file and then add the JS code to the actual pages I want it to function on for each registered user - it should work?

I can do that.

It's this bit that got me - "Make sure you change the path/URL to for the intercom.io script and you intercom-init.io script."

I'm not sure what needs changing and where here?

Thanks guys,

User Gravatar

RuAnderson

Posted Mar 27 2015 5:55 PDT

Hello,

I suggest use of Intercom for Wordpress plugin. Just follow these steps:

  1. Upload the intercom-for-wordpress folder to your wp-content/plugins/ directory.
  2. Activate the plugin through the Plugins menu in WordPress.
  3. Go to the settings page.
  4. Enter your Intercom App ID.
  5. Choose your preferred username format, optional custom data and whether to track admin pages.
  6. Highly recommended: for extra security, enable secure mode from within your Intercom app and enter your secret key in the settings page.

If you need help, send me your wordpress login details to mail@remmy.cz with Intercom App ID and secret key (if you want to use it). I will configure it for you.

User Gravatar

Remmy

Posted Mar 28 2015 3:21 PDT

Solution

This didn't solve your task? Get your own custom solution.

Thanks Remmy I have tried the plug in previously but noticed it added the intercom to every page of the site - I'm keen to only have it on members only pages.

Assuming this can't be changed?

User Gravatar

RuAnderson

Posted Mar 28 2015 3:34 PDT

It can be done, this is from plugin's FAQ:

Can I completely disable the snippet on certain pages?

Sure, just use the ll_intercom_output_snippet filter. Here's an example:

add_filter( 'll_intercom_output_snippet', 'no_intercom_on_page_10' );
  
  function no_intercom_on_page_10( $show ) {
  
      if ( is_page( 10 ) )
          return false;
  
      return true;
  
  }
  

You can use same method to enable plugin only on pages defined by you.

Also, the plugin only shows for logged in users, isn't that what you want?

User Gravatar

Remmy

Posted Mar 28 2015 3:38 PDT

@RuAnderson Members only page means what? Is this any specific page? or logged in page?

You can add below snippet code in your functions.php file located inside your theme folder.

add_filter( 'll_intercom_output_snippet', 'block_intercom_code' );
function block_intercom_code($show){
//if you want to add only on loggedin page then here is code
if(is_user_logged_in()){
return true;
}
//for specific page
$current_page = get_the_title();
if($current_page == "members"){
return true;
}
}

Please try this and let me know in case any query.

User Gravatar

JBNavadiya

Posted Mar 28 2015 4:00 PDT

Brillant thanks!

So with this app I don't have to add any code to pages etc? It all takes care of itself?

User Gravatar

RuAnderson

Posted Mar 28 2015 4:18 PDT

Yes, it does. Did you figure out the displaying of Intercom on members only pages or you need help with that?

User Gravatar

Remmy

Posted Mar 28 2015 4:20 PDT

Providing it only shows it when logged in then it doesn't hugely matter where it shows - it will ensure they get to the right pages.

I've yet to test it out, but I've installed the app again and will try again.

User Gravatar

RuAnderson

Posted Mar 28 2015 4:49 PDT

Hello RuAnderson,

just wanted to ask if you have solved the problem or you need any help?

User Gravatar

Remmy

Posted Apr 3 2015 8:15 PDT

You solved my problem Remmy - thank you!

User Gravatar

RuAnderson

Posted Apr 7 2015 0:12 PDT

Add a reply

By posting a reply on CodersClan you agree to our Terms & Conditions