Identifying a person

Identifying a person is the process of converting a guest (an anonymous visitor to your website) into a contact by associating it with an email. Besides the email you can add any other information you consider important (name, plan, etc.) for the contact.

In this section you will find some examples using the libraries that we have created for common programming languages. If your language does not appear below, don't worry, you just need to send an HTTP POST request as shown in this section.

To identify a visitor from the browser with JavaScript you will need to:

  1. Make sure you have included the tracking code in every page of your website or application.
  2. Identify the visitor with the following line (replace the email with the actual email of the contact):
    _dp("identify", {
      email: "[email protected]"
    });

    You can also attach more information to the contact:

    _dp("identify", {
      email: "[email protected]",
      first_name: "Germán",
      last_name: "Escobar",
      user_id: 23,
      plan: "free"
    });

    Read this:

    The JS (Browser) library will identify any visitor to your site as a "Guest" by automatically passing the value (pid) of the cookie that ConvertLoop installs in your visitor's browser. The cookie is represented by the key:value pair: dp_pid: pid

    To turn a "Guest" into a "Contact" you need to pass at least the email of the visitor along with the pid.

    You can not add or remove people from a segment using the JS (Browser) library.

    Learn more about the attributes of the identify function

    Check out some examples and a detailed explanation on ConvertLoop's Create or Update Contacts Guide.

To identify a visitor from PHP (using Composer):

  1. Install the library running the following command:
    $ composer require convertloop/convertloop-php
  2. Instantiate the ConvertLoop\ConvertLoop class passing your credentials:
    $convertloop = new \ConvertLoop\ConvertLoop("your_app_id", "your_api_key", "v1");
    You can find your app_id and api_key in Settings -> Account once you are logged in.
  3. Identify the visitor:
    $convertloop->people()->createOrUpdate(array("email" => "[email protected]", "user_id" => 23, "pid" => "8t16f883"));

    You can attach additional information to the contact:

    $convertloop->people()->createOrUpdate(array(
        "email" => "[email protected]",
        "pid" => "8t16f883",
        "user_id" => 23,
        "first_name" => "German",
        "last_name" => "Escobar",
        "plan" => "free"
    ));

    Read this:

    To identify a visitor to your site, you need to pass at least one of the following attributes to the function: pid, user_id or email.

    Use pid when you are automatically identifying someone even if they are not logged into your site. You can obtain this value (pid) from the dp_pid: pid cookie that ConvertLoop automatically installs in your visitor's browser with your tracking code.

    When creating or updating a contact from your backend, we recommend that you send the pid as a parameter of the function. This will merge the entire story of the actions executed by each visitor, even those that occourred before you captured their email address for the first time.

    Use user_id to match the id of the user in your application when the visitor you want to identify is logged into your site.

    Learn more about the attributes of the create or update function

    If you implemented a previous version of ConvertLoop's API using Tags, don't worry: all your Tags have already been automatically converted into Segments, and there is no action required in your code implementation to make them work.

    Check out some examples and a detailed explanation on ConvertLoop's Create or Update Contacts Guide.

Check out the PHP API Client for more information.

To identify a visitor from Ruby on Rails:

  1. Install the gem in your Gemfile:
    gem 'convertloop', '0.1.2'
  2. Run bundle install from the command line.
  3. Create a file config/initializers/convertloop.rb and paste the following code:
    ConvertLoop.configure(
      app_id: 'your_app_id',
      api_key: 'your_api_key'
    )
    You can find your app_id and api_key in Settings -> Account once you are logged in.
  4. Identify the visitor:
    ConvertLoop.people.create_or_update(email: "[email protected]", user_id: 23, pid: "8t16f883")

    You can attach additional information to the contact:

    ConvertLoop.people.create_or_update(
      email: "[email protected]",
      user_id: 23,
      pid: "8t16f883",
      first_name: "German",
      last_name: "Escobar",
      plan: "free"
    )

    Read this:

    To identify a visitor to your site, you need to pass at least one of the following attributes to the function: pid, user_id or email.

    Use pid when you are automatically identifying someone even if they are not logged into your site. You can obtain this value (pid) from the dp_pid: pid cookie that ConvertLoop automatically installs in your visitor's browser with your tracking code.

    When creating or updating a contact from your backend, we recommend that you send the pid as a parameter of the function. This will merge the entire story of the actions executed by each visitor, even those that occourred before you captured their email address for the first time.

    Use user_id to match the id of the user in your application when the visitor you want to identify is logged into your site.

    Learn more about the attributes of the create or update function

    If you implemented a previous version of ConvertLoop's API using Tags, don't worry: all your Tags have already been automatically converted into Segments, and there is no action required in your code implementation to make them work.

    Check out some examples and a detailed explanation on ConvertLoop's Create or Update Contacts Guide.

Check out the Ruby API Client for more information.

To identify a visitor from Ruby (without bundler):

  1. Install the gem from your command line:
    $ gem install convertloop
  2. Configure the ConvertLoop object passing your credentials.
    require 'convertloop'
    ConvertLoop.configure(
      app_id: 'your_app_id',
      api_key: 'your_api_key'
    )
    
    You can find your app_id and api_key in Settings -> Account once you are logged in.
  3. Identify the visitor:
    ConvertLoop.people.create_or_update(email: "[email protected]",user_id: 23, pid: "8t16f883")

    You can attach additional information to the contact:

    ConvertLoop.people.create_or_update(
      email: "[email protected]",
      user_id: 23,
      pid: "8t16f883",
      first_name: "German",
      last_name: "Escobar",
      plan: "free"
    )

    Read this:

    To identify a visitor to your site, you need to pass at least one of the following attributes to the function: pid, user_id or email.

    Use pid when you are automatically identifying someone even if they are not logged into your site. You can obtain this value (pid) from the dp_pid: pid cookie that ConvertLoop automatically installs in your visitor's browser with your tracking code.

    When creating or updating a contact from your backend, we recommend that you send the pid as a parameter of the function. This will merge the entire story of the actions executed by each visitor, even those that occourred before you captured their email address for the first time.

    Use user_id to match the id of the user in your application when the visitor you want to identify is logged into your site.

    Learn more about the attributes of the create or update function

    If you implemented a previous version of ConvertLoop's API using Tags, don't worry: all your Tags have already been automatically converted into Segments, and there is no action required in your code implementation to make them work.

    Check out some examples and a detailed explanation on ConvertLoop's Create or Update Contacts Guide.

Check out the Ruby API Client for more information.

To identify a visitor from Node.js:

  1. Install the package from your command line:
    $ npm install convertloop
  2. Configure the ConvertLoop object passing your credentials.
    const Convertloop = require('convertloop')
    const convertloop = new Convertloop({
      app_id: 'your_app_id',
      api_key: 'your_api_key'
    })
    You can find your app_id and api_key in Settings -> Account once you are logged in.
  3. Identify the visitor:
    convertloop.people.create_or_update({email: "[email protected]", user_id: 23, pid: "8t16f883"})
    

    You can attach additional information to the contact:

    convertloop.people.create_or_update({
      email: "[email protected]",
      user_id: 23,
      pid: "8t16f883",
      first_name: "German",
      last_name: "Escobar",
      plan: "free"
    })

    Read this:

    To identify a visitor to your site, you need to pass at least one of the following attributes to the function: pid, user_id or email.

    Use pid when you are automatically identifying someone even if they are not logged into your site. You can obtain this value (pid) from the dp_pid: pid cookie that ConvertLoop automatically installs in your visitor's browser with your tracking code.

    When creating or updating a contact from your backend, we recommend that you send the pid as a parameter of the function. This will merge the entire story of the actions executed by each visitor, even those that occourred before you captured their email address for the first time.

    Use user_id to match the id of the user in your application when the visitor you want to identify is logged into your site.

    Learn more about the attributes of the create or update function

    If you implemented a previous version of ConvertLoop's API using Tags, don't worry: all your Tags have already been automatically converted into Segments, and there is no action required in your code implementation to make them work.

    Check out some examples and a detailed explanation on ConvertLoop's Create or Update Contacts Guide.

Check out the Node API Client for more information.

To identify a visitor from Java:

  1. Add the dependency in your pom.xml file:
    <dependency>
      <groupId>co.convertloop</groupId>
      <artifactId>convertloop-java</artifactId>
      <version>0.1.0</version>
    </dependency>
    Or add the dependency in your build.gradle file:
    dependencies {
        compile 'co.convertloop:convertloop-java:0.1.0'
    }
  2. Configure the ConvertLoop object passing your credentials:
    Convertloop convertloop = new Convertloop("your_app_id", "your_api_key", "v1");
    You can find your app_id and api_key in Settings -> Account once you are logged in.
  3. Identify the visitor:
    HashMap contact = new HashMap();
    contact.put("email", "[email protected]");
    contact.put("user_id", 23);
    contact.put("pid", "8t16f883");
    convertloop.createOrUpdatePerson(contact);

    You can attach additional information to the contact:

    HashMap contact = new HashMap();
    contact.put("email", "[email protected]");
    contact.put("user_id", 23);
    contact.put("pid", "8t16f883");
    contact.put("first_name", "Alejandro");
    contact.put("last_name", "Escobar");
    contact.put("plan", "free");
    convertloop.createOrUpdatePerson(contact);
  4. Read this:

    To identify a visitor to your site, you need to pass at least one of the following attributes to the function: pid, user_id or email.

    Use pid when you are automatically identifying someone even if they are not logged into your site. You can obtain this value (pid) from the dp_pid: pid cookie that ConvertLoop automatically installs in your visitor's browser with your tracking code.

    When creating or updating a contact from your backend, we recommend that you send the pid as a parameter of the function. This will merge the entire story of the actions executed by each visitor, even those that occourred before you captured their email address for the first time.

    Use user_id to match the id of the user in your application when the visitor you want to identify is logged into your site.

    Learn more about the attributes of the create or update function

    If you implemented a previous version of ConvertLoop's API using Tags, don't worry: all your Tags have already been automatically converted into Segments, and there is no action required in your code implementation to make them work.

    Check out some examples and a detailed explanation on ConvertLoop's Create or Update Contacts Guide.

Check out the Java API Client for more information.

To identify a visitor from your command line (Linux or Mac) run the following command (replace the highlighted info with your own data):

$ curl -i -u app_id:api_key \
-X POST \
-H "Content-Type: application/json" \
-d '{ "email": "[email protected]" }' \
https://api.convertloop.co/v1/people
You can find your app_id and api_key in Settings -> Account once you are logged in.

Response

After making the request you should receive a JSON response similar to the following:

{
  "pid" : "fe737ab6",
  "user_id": null,
  "email": "[email protected]",
  "name": "",
  "first_seen_at": null,
  "last_seen_at":null,
  "created_at":"2016-12-06T04:48:42.204Z",
  "tags": []
}

Read this:

To identify a visitor to your site, you need to pass at least one of the following attributes to the function: pid, user_id or email.

Use pid when you are automatically identifying someone even if they are not logged into your site. You can obtain this value (pid) from the dp_pid: pid cookie that ConvertLoop automatically installs in your visitor's browser with your tracking code.

When creating or updating a contact from your backend, we recommend that you send the pid as a parameter of the function. This will merge the entire story of the actions executed by each visitor, even those that occourred before you captured their email address for the first time.

Use user_id to match the id of the user in your application when the visitor you want to identify is logged into your site.

Check out some examples and a detailed explanation on ConvertLoop's Create or Update Contacts Guide.