Tanta Innovative LogoTanta Innovative Logo
  1. Home
  2. How To Guides And Tutorials
  3. How To Integrate Intercom In Your Nextjs 14 Project
tanta innovative logo

Lekki Peninsular, 104106 Lagos, Nigeria

+234 201-453-6000

hello@tantainnovatives.com
Become our AgentPrivacy PolicyTerms of Service
DMCA.com Protection Status

© 2025 Tanta Innovative. All Rights Reserved.

ISO Certification
  1. Home
  2. How To Guides And Tutorials
  3. How To Integrate Intercom In Your Nextjs 14 Project

How to Integrate Intercom in Your Next.js 14 Project

Abraham Esandayinze Tanta

Abraham Esandayinze Tanta

· 3 min read min read

0

0

How to Integrate Intercom in Your Next.js 14 Project

TypeScript
1// src/components/IntercomClientComponent.tsx
2
3'use client';
4import { useEffect } from "react";
5
6
7const IntercomClientComponent: React.FC = () => {
8  useEffect(() => {
9    window.intercomSettings = {
10      api_base: "https://api-iam.intercom.io",
11      app_id: "{YOUR_INTERCOM_APP_ID}" // Replace with your actual Intercom app ID.
12    };
13
14
15    if (window.Intercom) {
16      window.Intercom('reattach_activator');
17      window.Intercom('update', window.intercomSettings);
18    } else {
19      const script = document.createElement('script');
20      script.src = 'https://widget.intercom.io/widget/{YOUR_INTERCOM_APP_ID}';
21      script.async = true;
22      document.body.appendChild(script);
23    }
24  }, []);
25
26  return null;
27};
28
29export default IntercomClientComponent;
30

TypeScript
1// src/layouts/RootLayout.tsx
2
3import React from "react";
4import Script from "next/script";
5import IntercomClientComponent from "@/components/IntercomClientComponent";
6
7const RootLayout = ({ children }: { children: React.ReactNode }) => (
8    <html lang="en">
9    <body>
10    <main>
11        {children}
12    </main>
13    <Script
14        strategy="afterInteractive"
15        id="intercom-settings"
16        dangerouslySetInnerHTML={{
17            __html: `
18            window.intercomSettings = {
19              api_base: "https://api-iam.intercom.io",
20              app_id: "{YOUR_INTERCOM_APP_ID}"
21            };
22          `,
23        }}
24    />
25    <IntercomClientComponent />
26    </body>
27    </html>
28);
29
30export default RootLayout;
31

TypeScript
1// src/components/IntercomClientComponent.tsx
2
3interface IntercomClientComponentProps {
4    userId?: string;
5    userEmail?: string;
6}
7
8const IntercomClientComponent: React.FC<IntercomClientComponentProps> = ({ userId, userEmail }) => {
9    useEffect(() => {
10        const settings = {
11            api_base: "https://api-iam.intercom.io",
12            app_id: "{YOUR_INTERCOM_APP_ID}",
13            user_id: userId,
14            email: userEmail,
15        };
16
17        window.intercomSettings = settings;
18
19        if (window.Intercom) {
20            window.Intercom('reattach_activator');
21            window.Intercom('update', settings);
22        } else {
23            const script = document.createElement('script');
24            script.src = 'https://widget.intercom.io/widget/{YOUR_INTERCOM_APP_ID}';
25            script.async = true;
26            document.body.appendChild(script);
27        }
28    }, [userId, userEmail]);
29
30    return null;
31};
32
33export default IntercomClientComponent;

Intercom integrationTypescript
Loading comments...
Abraham Esandayinze Tanta

Abraham Esandayinze Tanta

4 Articles

As the Founder and CEO of Tanta Innovative Limited and Tanta Secure, I lead two IT firms that deliver innovative and secure solutions across Nigeria and beyond. With over a decade of expertise in ethical hacking, software development, Linux and network administration, I specialize in cybersecurity and malware detection. I hold a BSc in Computer Science from the Federal University of Technology and have earned multiple ethical hacking certifications. Fluent in Hausa, English, and French, I am passionate about leveraging the latest technologies to create value while ensuring the safety and privacy of users and their data.

More from Abraham Esandayinze Tanta

Guide to Choosing the Right Software Development Partner
Guide to Choosing the Right Software Development Partner

Picking the right software development partner is vital for success. Asking the right questions helps you assess experti...

Abraham Esandayinze TantaAbraham Esandayinze Tanta·5 min read
How Nigerian Businesses Can Effectively Respond to Data Breaches
How Nigerian Businesses Can Effectively Respond to Data Breaches

Data breaches are a threat to any business. In Nigeria, the NDPR sets out strict guidelines that must be followed in th...

Abraham Esandayinze TantaAbraham Esandayinze Tanta·5 min read
Cloud vs. On-Premise Software: Which is Right for Your Business?
Cloud vs. On-Premise Software: Which is Right for Your Business?

As a CEO with 15 years of experience in Nigeria's IT sector, I've seen firsthand how the cloud vs. on-premise decision s...

Abraham Esandayinze TantaAbraham Esandayinze Tanta·5 min read
Cross-Border Data Transfers: A Nigerian Company's Guide to Global Data Compliance
Cross-Border Data Transfers: A Nigerian Company's Guide to Global Data Compliance

Sending data across borders? Don't risk hefty fines and reputational damage. Learn how to safeguard your business in a g...

Abraham Esandayinze TantaAbraham Esandayinze Tanta·5 min read
See all articles by Abraham Esandayinze Tanta

Related Articles

Discover more insights and stories from our collection of articles

Integrating Spotify in Android Apps: Web API + SDK Tutorial 2025
How To Guides And Tutorials9 min read min read

Integrating Spotify in Android Apps: Web API + SDK Tutorial 2025

Learn how to integrate Spotify's Web API and SDK into your Android app to add music streaming, user data, and playlist features—perfect for unique portfolio projects.

Olisemeka Nwaeme
Olisemeka Nwaeme·July 5, 2025
Getting started with the LLAMA 3.2-11B with groq
How To Guides And Tutorials3 min read min read

Getting started with the LLAMA 3.2-11B with groq

The LLAMA 3.2-11B model is a very powerful model that can perform both text and vision tasks.

Omolayo Timothy Ipinsanmi
Omolayo Timothy Ipinsanmi
Streamline Your Backend Workflow with Reusable Components
How To Guides And Tutorials6 min read min read

Streamline Your Backend Workflow with Reusable Components

Learn how backend developers can save time by creating reusable components for common tasks, streamlining project setups, improving consistency, and boosting productivity.

Meshach Philips
Meshach Philips
View More Articles
Intercom is a powerful tool for businesses needing efficient customer communication. Integrating it into your Next.js 14 project can enhance customer interactions and improve satisfaction.
Prerequisites
Step-by-Step Integration Guide
You’ll create a dedicated component for Intercom and integrate it into your layout. This will allow Intercom to load correctly throughout your project.
Dynamic Integration of Intercom in Next.js 14
Pass user data to personalize customer interactions.
Optimization Tips for Next.js 14 Script Management
Troubleshooting Common Integration Issues
Next Steps
Step 1: Create 
IntercomClientComponent
Step 2: Integrate into 
RootLayout


  • An existing Next.js 14 project.
  • Active Intercom account.
  • Access to your Intercom app ID.
  • Go to your components folder.
  • Create a file called IntercomClientComponent.tsx.
  • Add this TypeScript code:
  • Replace {YOUR_INTERCOM_APP_ID} with your Intercom app ID.

  • Open your layout file (e.g., layout.tsx).
  • Import the IntercomClientComponent.
  • Add the Intercom script to ensure it loads after the page content.
  • Update IntercomClientComponent to accept user props:
  • Pass user data from RootLayout:


    <IntercomClientComponent
    userId={user.id}
    userEmail={user.email}

    />
  • Use Next.js Script component to manage script loading for better performance.
  • Set script loading to afterInteractive to prevent render-blocking issues.
  • Script Errors: Ensure scripts load after all necessary DOM elements to avoid errors.
  • User Data Not Updating: Confirm that props such as userId and userEmail are being correctly passed to the component.
  • Visit our  to contribute or explore more examples for integrating Intercom with Next.js 14.
  • Stay updated with the latest improvements to both Intercom and Next.js for continuous enhancement of your customer engagement features.
  • GitHub repository