-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lazy load #59
Comments
x2 on this. Was just coming here to post a question about this. |
This should be fairly straight-forward to implement. Looking at the current install example from Intercom's documentation, they actually do wait for the onload event before adding the intercom script tag to the webpage there now: I assume wrapping the following lines in a function that is called when the onload event fires should work: Lines 35 to 50 in 6d1bf31
|
@nhagen Do you think this can be implemented? It really slows down the website performance :/ |
Is there any reason we shouldn't implement this on our side? I'm just rendering class MyComponent extends Component {
state = { intercomVisible: false };
componentDidMount() {
this.intercomTimeout = setTimeout(this.showIntercom, 3000);
}
componentWillUnmount() {
clearTimeout(this.intercomTimeout);
}
showIntercom = () => {
this.setState({ intercomVisible: true });
};
render() {
return this.state.IntercomVisible && <Intercom />
}
} |
@GeKorm That doesn't really make a difference. |
@JPWallhorn Have you tried it? react-intercom has no way of loading the script before the 3 seconds (or whatever trigger you set) in the example above. |
@GeKorm Yes, I've implemented a 1 sec delay and it still drags down the performance & time for visible content. |
One second is probably just not enough, I use 7-10 and a scroll trigger. Try adding just a scroll trigger and nothing else, you'll see that the |
I believe I've implemented this in #73 and v2.0.0-alpha.1. Closing, but if this is actually not addressed, please let me know before a full 2.0 release. |
@JPWallhorn @GeKorm @CarloSaccone @GarrettJMU Features
Motivation Note |
Is it possible to lazy-load the intercom script & init event? Loading the script in the head tag has a massive impact on the page load speed and time to interactive.
The text was updated successfully, but these errors were encountered: