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:
_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"
});
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):
$ composer require convertloop/convertloop-php
ConvertLoop\ConvertLoop
class passing your credentials:
$convertloop = new \ConvertLoop\ConvertLoop("your_app_id", "your_api_key", "v1");
$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"
));
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.
To identify a visitor from Ruby on Rails:
gem 'convertloop', '0.1.2'
bundle install
from the command line.config/initializers/convertloop.rb
and paste the following code:
ConvertLoop.configure(
app_id: 'your_app_id',
api_key: 'your_api_key'
)
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"
)
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.
To identify a visitor from Ruby (without bundler):
$ gem install convertloop
require 'convertloop'
ConvertLoop.configure(
app_id: 'your_app_id',
api_key: 'your_api_key'
)
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"
)
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.
To identify a visitor from Node.js:
$ npm install convertloop
const Convertloop = require('convertloop')
const convertloop = new Convertloop({
app_id: 'your_app_id',
api_key: 'your_api_key'
})
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"
})
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.
To identify a visitor from Java:
<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'
}
Convertloop convertloop = new Convertloop("your_app_id", "your_api_key", "v1");
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);
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.
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
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": []
}
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.