Articles on: My Contacts

How can I automatically set user company?

If you are using Crisp on a website where users are authenticated, you may want to set their company attributes, so that you can store where this user works.

This method uses the Crisp JavaScript API, that you can call from your own code. Given that you know the authenticated user's company attributes from your code (eg. company name, website, location, etc.), you'll be able to set it for the Crisp chatbox.

Note that in order for the company to be saved in your Contacts database, the user email should be set at any point (before or after pushing the company), and you should be subscribed to a paid plan (Mini, Essentials or Plus).

Here's how you would proceed to set the visitor's company:

// Feed this call with your own company data (replacing Crisp as a company).
$crisp.push(["set", "user:company", [
    "Crisp", {
        url: "https://crisp.chat/",
        description: "Give your customer experience a human touch.",
        employment: ["CTO", "Software Engineer"],
        geolocation: ["FR", "Nantes"]
    }
]]);


Note that the company object passed as second argument is optional. Only the company name is required. If you only know the company name, you may simply call: $crisp.push(["set", "user:company", ["Crisp"]])

Here's how you would proceed to get the visitor's company:

var visitor_company = $crisp.get("user:company");


Want to know more about the $crisp interface? Read: How to use $crisp Javascript SDK?

Updated on: 04/11/2024

Was this article helpful?

Share your feedback

Cancel

Thank you!