Adding tags to customers
ChartMogul lets you add any number of tags to customers. You can filter your customers using these tags, create customer segments, and track the metrics of these segments over time.
For example, you can tag customers with their feature requests, and prioritize features by comparing their MRR impact. Similarly, you could tag customers if they become a churn risk, and use that in combination with MRR metrics to drive churn mitigation efforts.
Tag customers using either the API or the app
You can add and remove customer tags using both the API and the app. Using the API is recommended for syncing tags with other tools you use, like CRM and marketing tools.
Using the API to add tags to customers
There are three ways in which you can add tags to customers using the API.
1. Add tags when creating the customer
The Create a Customer endpoint allows you to include tags. This is useful if you want to include some tags while importing customers into ChartMogul from your billing system.
curl -X POST "https://api.chartmogul.com/v1/customers" \
-u YOUR_API_KEY: \
-H "Content-Type: application/json" \
-d '{
"data_source_uuid": "ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
"external_id": "cus_0001",
"name": "Adam Smith",
"attributes": {
"tags": ["managed-account", "high-value"]
}
}'
ChartMogul::Customer.create!(
data_source_uuid: "ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
external_id: "cus_0001",
name: "Adam Smith",
attributes: {
tags: ["managed-account", "high-value"],
},
)
ChartMogul.Customer.create(config, {
data_source_uuid: "ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
external_id: "cus_0001",
name: "Adam Smith",
attributes: {
tags: ["managed-account", "high-value"],
},
});
ChartMogul\Customer::create([
"data_source_uuid" => "ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
"external_id" => "cus_0001",
"name" => "Adam Smith",
"attributes" => [
"tags" => ["managed-account", "high-value"]
]
]);
api.CreateCustomer(&cm.NewCustomer{
DataSourceUUID: dsUUID,
ExternalID: "cus_0001",
Name: "Adam Smith",
Email: "[email protected]",
Country: "US",
City: "New York",
LeadCreatedAt: "2015-10-14",
FreeTrialStartedAt: "2015-11-01",
Attributes: &cm.NewAttributes{
Tags: []string{"managed-account", "high-value"},
},
})
ChartMogul.Customer.create(
config,
data={
"data_source_uuid": "ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
"external_id": "cus_0001",
"name": "Adam Smith",
"attributes": {"tags": ["managed-account", "high-value"]},
},
)
2. Add tags to an existing customer using their UUID
You can add tags to a customer after they have been created in ChartMogul using their ChartMogul UUID. This is useful when you want to add tags on an ongoing basis from one or several data sources.
curl -X POST "https://api.chartmogul.com/v1/customers/cus_de305d54-75b4-431b-adb2-eb6b9e546012/attributes/tags" \
-u YOUR_API_KEY: \
-H "Content-Type: application/json" \
-d '{
"tags": ["feature-invite-teammates", "churn-risk-medium"]
}'
customer = ChartMogul::Customer.retrieve("cus_de305d54-75b4-431b-adb2-eb6b9e546012")
customer.add_tags!("feature-invite-teammates", "churn-risk-medium")
ChartMogul.Tag.add(config, "cus_de305d54-75b4-431b-adb2-eb6b9e546012", {
tags: ["feature-invite-teammates", "churn-risk-medium"],
});
$customer = ChartMogul\Customer::retrieve("cus_de305d54-75b4-431b-adb2-eb6b9e546012");
$customer->addTags("feature-invite-teammates", "churn-risk-medium");
api.AddTagsToCustomer(
"cus_de305d54-75b4-431b-adb2-eb6b9e546012",
[]string{"feature-invite-teammates", "churn-risk-medium"},
)
chartmogul.Tags.add(
config,
uuid="cus_de305d54-75b4-431b-adb2-eb6b9e546012",
data={"tags": ["feature-invite-teammates", "churn-risk-medium"]},
)
3. Add tags to existing customers using their email
You can also add tags to customers with a specific email address instead of the ChartMogul UUID. This is useful when you only have a customer's email address, and not their ChartMogul UUID. For instance, with automated integration services like Zapier.
curl -X POST "https://api.chartmogul.com/v1/customers/attributes/tags" \
-u YOUR_API_KEY: \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"tags": ["mailing-list-subscriber"]
}'
customers = ChartMogul::Customer.search("[email protected]")
customers.each { |c| c.add_tags!("mailing-list-subscriber") }
ChartMogul.Tag.add(config, {
email: "[email protected]",
tags: ["mailing-list-subscriber"],
});
$customers = ChartMogul\Customer::search("[email protected]");
foreach ($customers->entries as $customer) {
$customer->addTags(["mailing-list-subscriber"]);
}
api.AddTagsToCustomersWithEmail(
"[email protected]",
[]string{"mailing-list-subscriber"},
)
chartmogul.Tags.add(
config, data={
"email": "[email protected]",
"tags": ["mailing-list-subscriber"]}
)
It's important to note that the tags will be added to all customers that have the specified email address in your account.
What else can I do with tags using the API?
You can also remove tags from a customer if they are no longer relevant to that customer.
There is no limit to the number of tags you can add in ChartMogul so feel free to add as many as you need to gain insight into your customer metrics.
How can I segment my customers using the tags?
Once you add tags to your customers in ChartMogul, you can use them to filter and segment your customers. Learn how to use Segmentation in our help center.
Updated 3 months ago