Setting up Identify

Identify is how you send information to Freshpaint and your destinations about who your users are. There are two parts to using identify:

  • Attaching unique identifiers to users.

  • Attaching properties to users.

Attaching Unique Identifiers

By default, when a user visits your site, Freshpaint and downstream tools will identify the user based on a randomly generated identifier. This means when a user visits your site on their phone and on their laptop, they will show up as two different users. To remedy this situation, Freshpaint provides identify. A way for you to provide your own identifier so Freshpaint and downstream tools can merge the data across different devices.

To setup identify, you can call the identify API call. The following example call attaches the identifier [email protected] to the current user:

Web
React Native
iOS Swift
iOS Objective-C
Android
Web
freshpaint.identify("[email protected]");
React Native
Freshpaint.identify("[email protected]");
iOS Swift
Freshpaint.shared().identify("[email protected]");
iOS Objective-C
[[FPAnalytics sharedAnalytics] identify:@"[email protected]"]
Android
Freshpaint
.with(getActivity().getApplicationContext())
.identify("[email protected]");

When setting up identify, we recommend calling freshpaint.identify() in two different places:

  • When a user registers for an account.

  • When a user signs in.

As for a unique identifier, if you have internal ids that are unique to a user, we recommend using those. Otherwise, we recommend using either the username or the email of the user.

Attaching User Properties

The second part of identify is attaching properties to user. This allows you to send information you have about the user into Freshpaint your destinations. To attach properties to a user, you pass in the properties you want to set as the second argument to freshpaint.identify():

Web
React Native
iOS Swift
iOS Objective-C
Android
Web
freshpaint.identify({
"email": "[email protected]",
"name": "Ada Lovelace"
});
React Native
Freshpaint.identify({
"email": "[email protected]",
"name": "Ada Lovelace"
});
iOS Swift
Freshpaint.shared().identify(
nil,
traits: [
"email": "[email protected]",
"name": "Ada Lovelace"
]
)
iOS Objective-C
[[FPAnalytics sharedAnalytics]
identify:nil
traits:@{ @"email": @"[email protected]",
@"name": @"Ada Lovelace" }]
Android
Freshpaint
.with(getActivity().getApplicationContext())
.identify(new Traits()
.putValue("email", "[email protected]")
.putValue("name", "Ada Lovelace")
);

You should pass any information you know about your users that you want to use in your downstream tools to freshpaint.identify().

freshpaint.identify() can also be called with both an identifier and a JSON object at the same time:

Web
React Native
iOS Swift
iOS Objective-C
Android
Web
freshpaint.identify("[email protected]", {
"email": "[email protected]",
"name": "Ada Lovelace"
});
React Native
Freshpaint.identify("[email protected]", {
"email": "[email protected]",
"name": "Ada Lovelace"
});
iOS Swift
Freshpaint.shared().identify(
traits: [
"email": "[email protected]",
"name": "Ada Lovelace"
]
);
iOS Objective-C
[[FPAnalytics sharedAnalytics]
identify:@"[email protected]"
traits:@{ @"email": @"[email protected]",
@"name": @"Ada Lovelace" }]
Android
Freshpaint
.with(getActivity().getApplicationContext())
.identify("[email protected]", new Traits()
.putValue("email", "[email protected]")
.putValue("name", "Ada Lovelace")
);