JavaScript Installation

Learn how to install Userlove JavaScript code snippet in your application / website

Userlove SDK Installation

Why do you need to install the Userlove code snippet? To display Userlove in-product experiences to the right users at the right time, you'll need add the Userlove code snippet to your application.

Do I need to have technical expertise? You don't need technical expertise to use Userlove, but for these methods, we suggest you involve technical team members to help with implementation. Once installed, you won't need any further help from developers, and you can manage everything from the Userlove Dashboard.

Here are the steps to install the Userlove code snippet and publish experiences to your users.

  1. Login to your Userlove account.

  2. Open Settings.

  3. Click on Manage Domain.

  4. Click on Add domain button.

  5. Click on Install Script button.

  6. Copy or email your tracking code and Send it to your developer.

  7. Once the Script has been Installed, your Account will be ready for use Userlove feature.

Identify users

How to identify and send user properties to Userlove? To show the right content to the right users at the right time, you must identify users with the "identify" event and send their data to Userlove.

It's requires to an "id" (YOUR_USER_ID), Name and Email to userlove() function as per the instructions below, You can leverage this information for better targeting and personalizing experiences.

We recommend passing as much information as possible about your users. The more data you provide, the better we can target and personalize the onboarding experience for each user.

userlove("identify", {
  id: "YOUR_USER_ID", // Replace with your unique user ID (required)
  userData: {
    // recommended properties for personalization (optional)
    name: "John Doe", // current user's full name
    email: "john@example.com", // Current user's email
    join_date: "2023-05-17T08:42:25.253Z", // ISO format (ie.2023-05-17T08:42:25.253Z) of user signup date
    plan: "Startup", // Current user's plan name
    purchased_at: "2023-05-17T08:42:25.253Z", // ISO format (ie.2023-05-17T08:42:25.253Z) of account purchase date (leave null if empty)
    role: "Manager", // Current user's role or permissions
    account_id: "1234XYZ", // Current user's account ID
    company_name: "Acme Corp", // Current user's company name
    renewal_date: "2023-05-17T08:42:25.253Z", // ISO format (ie.2023-05-17T08:42:25.253Z) to remind users for renewal etc.
  },
});

Events Tracking

By tracking events in your application, it allows you to show Userlove's content based on what actions the user has taken or hasn't taken. This can also help you see how your content affects user behavior.

You can use the following event tracking code to track any custom event and send data to the Userlove platform.

userlove("track", {
  event: "CustomEvent", // Replace with your custom event name
  data: {
    // Replace with your custom event data
    // For example:
    product_id: "123456789",
    product_name: "Sneaker Shoes",
    product_price: 299.99,
    product_category: "Electronics",
  },
});

If you just want to track event without data, for example some specific button click event without sending any custom data, you can use following code

userlove("track", {
  event: "CustomEvent", // Replace with your custom event name
});

Last updated