Getting Started with GoLogin and Puppeteer: A Beginner’s Guide to Browser Fingerprinting in Node.js (TypeScript)

🔹 Introduction to GoLogin and it’s features

GoLogin is a powerful browser identity management tool that lets you create and control multiple browser profiles, each with its own unique fingerprint. Instead of juggling multiple devices or clearing cookies, you can manage everything in one place while still appearing as independent users online.

When combined with Puppeteer, GoLogin becomes even more useful for developers. It allows you to automate tasks like testing, scraping, or account management in a way that looks natural and avoids detection. This makes it especially valuable for developers, marketers, and businesses who rely on automation and multi-account workflows.

👉 Key Features of GoLogin:

  • Unique browser fingerprints for each profile.
  • Built-in proxy integration for secure browsing.
  • Cloud sync to access profiles anywhere.
  • Team collaboration and sharing options.
  • Cross-platform support (Windows, macOS, Linux, and Android).
  • Puppeteer & Selenium support for seamless automation.

📖 What We’ll Do in This Guide

  • Install required packages
  • Get GoLogin API token
  • Create a GoLogin profile
  • Launch the browser with GoLogin
  • Use Puppeteer with the GoLogin browser (demo)
  • Close the browser
  • Delete the GoLogin profile

1️⃣ Install Required Packages

To get started, we need to set up a Node.js project with TypeScript and install the required dependencies. In this guide, we’ll use:

  • GoLogin Node.js SDK → to interact with GoLogin profiles and browsers.
  • dotenv → to securely manage your GoLogin API token in an .env file.
npm install gologin dotenv

2️⃣ Get GoLogin API Token

To use GoLogin programmatically, you’ll need an API token. This token allows your Node.js app to authenticate with GoLogin and perform actions like creating profiles or launching browsers. Here’s how to get it:

  1. Log in to your GoLogin Dashboard → https://app.gologin.com
  2. Click on your profile avatar (top-right corner).
  3. Go to Profile → API → API Token.
  4. Copy the token and paste it into your .env file like this:
#dotenv
GOLOGIN_TOKEN = 'XXXXXXXXXXXX' //your_token

3️⃣ Create a GoLogin Profile

I will tell you two ways to create a Gologin profile:

🔹 1. Create a Profile with Random Fingerprint + GoLogin Proxy (Region-Based)

// ASSIGNING 'resident' TYPE OF PROXY TO PROFILE BASED ON THE REGION 
// DEFAULT TYPE OF PROXY IS 'mobile' WHICH IS NEEDED TO BE PURCHASED FROM GOLOGIN
async function createGoLoginProfile(email: string) {
  try {
    const GL = GologinApi({ token: process.env.GOLOGIN_TOKEN });
    const region = 'us';
    const { id } = await GL.createProfileRandomFingerprint(email);
    await GL.addGologinProxyToProfile(id, region, 'resident');
    await GL.exit();
    return id;
  }
  catch (error) {
    console.log(error);
    throw new Error("UNABLE TO CREATE PROFILE");
  }
}

You will receive ‘id'(profile id) using createProfileRandomFingerprint() which expects one argument name for the profile. I have used email as a profile name you can use anything of type string.
While adding a GoLogin proxy to profile I have used addGologinProxyToProfile() which expects profileId and countryCode which I assume you already have knowledge about this.

Important thing to always keep in mind here is third optional argument that is proxyType but it is only important when you want a specific type of proxy. It has three types mobile, resident & data center by default it allots mobile proxy.

I have attached below a code reference to know about what is addGologinProxyToProfile() and proxyType here.

type ProxyType = 'mobile' | 'resident' | 'dataCenter';
addGologinProxyToProfile: (profileId: string, countryCode: string, proxyType?: ProxyType | '') => Promise<ProxyResponse>;

🔹 2. Create a Profile with Custom Parameters

async function createGoLoginProfile(email: String): Promise<string> {
  try {
    const GL = GologinApi({ token: process.env.GOLOGIN_TOKEN });
    const profileId = await GL.createProfileWithCustomParams({
      name: email,
      os: 'win', //'lin' | 'mac' | 'win' | 'android'
      proxy: {
        mode: 'http', //'http' | 'https' | 'socks4' | 'socks5' | 'geolocation' | 'none' | 'tor' | 'gologin'
        host: '', //your host
        port: , //your port
        username: ``, // your proxy username
        password: '' // your proxy password
      },
      autoLang: true,
      folderName: "Vaibhav",
      notes: "testing"
    })
    await GL.exit();
    if (profileId) {
      return profileId;
    }
    else {
      throw new Error('UNABLE TO CREATE PROFILE');
    }
  }
  catch (error) {
    console.log(error);
    throw error;
  }
}

The method createProfileWithCustomParams() will create a custom Gologin profile with custom parameters. I have used a custom proxy which you can clearly see in the above code parameters like folderName and notes are some features you can see in the dashboard. I have also mentioned the options you can have for other parameters like os and proxy.mode, you can explore other options also from the official documentation.

NOTE : Never forget to exit the Gologin instance using exit(). If you are separating each functionality or implementing everything in a single function then try to stop the instance according to your usage.

4️⃣ Launch the Browser with GoLogin, Run a Puppeteer Demo, and Close the Session

After creating a profile, the next step is to launch a browser instance linked to that profile. This ensures your browsing session uses the unique fingerprint and proxy configuration tied to it.

async function launchGoLoginBrowser(profileId: string) {
  const GL = GologinApi({ token: process.env.GOLOGIN_TOKEN });
  // LAUNCH THE GOLOGIN PROFILE WITH EXTRA PARAMETERS (FOLLOWING OFFICIAL HEADLESS.JS EXAMPLE)
  // USING TYPE ASSERTION SINCE TYPESCRIPT DEFINITIONS ARE OUTDATED BUT API SUPPORTS EXTRA_PARAMS
  const { browser } = await GL.launch({
    // GOLOGIN PROVIDES A CLOUD BROWSER THAT CAN BE USED TO RUN PUPPETEER AUTOMATION.
    // IT WILL HANDLE THE BROWSER START AND CLOSE MANAGEMENT - YOU JUST NEED TO CONTROL THE BROWSER WITH PUPPETTER.
    // TO USE CLOUD BROWSER, UNCOMMENT THE LINE BELOW ELSE IT WILL USE THE LOCAL BROWSER
    // cloud:true, 
    profileId,
    extra_params: [
      // '--headless',
      '--disable-gpu',
      '--no-sandbox',
      '--disable-setuid-sandbox',
      '--disable-dev-shm-usage',
      '--display=:99'
    ],
    tmpdir: "C:/Desktop/gologin_data"
  } as any);

  const newPage = await browser.newPage();
  await newPage.goto('https://the-internet.herokuapp.com/login', { timeout: 60000 });
  try {
    const username = await newPage.waitForSelector('input#username');
    const password = await newPage.waitForSelector('input#password');
    const loginButton = await newPage.waitForSelector('button[type="submit"]');
    if (!username || !password || !loginButton) {
      console.log('UNABLE TO LOCATE USERNAME OR PASSWORD');
    }
    else {
      await username.type('tomsmith', { delay: 1000 });
      await password.type('SuperSecretPassword!', { delay: 1000 });
    }
    await Promise.all([
      loginButton.click(),
      newPage.waitForNavigation({ waitUntil: 'networkidle0' }),
    ]);
  } catch (error) {
    console.log('UNABLE TO LOCATE USERNAME OR PASSWORD');
  }
  await newPage.close();
  await browser.close();
  await GL.exit();
}

Read the above code properly if you are familiar with puppeteer then you do not need that much explanation, but in a summarized way to tell you I have just tested the puppeteer working through waiting for selectors, typing into input fields, triggering navigation by clicking a button and waiting for a successful navigation.

About the parameters I used in launch() method, you can read about cloud parameter in the commented lines in code.

I want to let you know about one specific parameter tmpdir, when you launch a local browser with a profile, GoLogin needs to create a temporary working directory on your system to hold things like Cookies, Cache, Browser session files, Extension data, etc. and once the browser closes, GoLogin usually syncs the important data back to their cloud profile storage, and the temp files may be removed.

5️⃣ Delete the GoLogin Profile

Once you’re done with testing or automation, you may want to delete the GoLogin profile you created earlier.

async function deleteGoLoginProfile(profileId: string) {
  try {
    const GL = GologinApi({ token: process.env.GOLOGIN_TOKEN });
    await GL.deleteProfile(profileId);
    await GL.exit();
    console.log("PROFILE DELETED WITH ID : ", profileId);
  }
  catch (error) {
    throw new Error("UNABLE TO DELETE PROFILE");
  }
}

🎯 Conclusion

In this guide, we explored how to integrate GoLogin with Puppeteer in Node.js (TypeScript). We started by installing the required packages, retrieved our GoLogin API token, created and launched a browser profile, ran a Puppeteer demo, and finally learned how to clean up by closing and deleting the profile.

✨ Thank you for reading this guide! I hope it was helpful.

Vaibhav Pushpad
Connect with me on LinkedIn

Similar Posts