#Variants
Today, users expect personalized content tailored to their preferences. Generic content is less effective because users prefer relevant content that appeals to them. With the introduction of Variants, Hygraph empowers content teams to deliver tailored content experiences that resonate with specific user Segments. This level of personalization not only enhances user engagement but also drives conversion rates.
#Key terms
Segments - A named reference used to target a group of users based on shared characteristics or behaviors. The actual user lists for these groups are defined and managed in an external system. You use Segments to deliver specific content, that is, Variants to these external user groups. Examples of shared characteristics for segmentation are:
- Demographics: Age, gender, location, language
- Behavioral data: Pages visited, products viewed, time on site
- Engagement: Frequency of visits, previous purchases, email interactions
Variants - Personalized versions of content entries that are served depending on the defined Segment. Variants define what version of the content a Segment sees.
A main content entry can have many Variants, each tailored to a specific Segment. These Variants are not separate entries but linked to the main entry. They inherit structure or layout from the main entry while allowing customization of certain fields.
#Benefits
With Variants, you can create different pieces of content for different audiences. Here are a few benefits of Variants:
- Enables personalization and A/B testing use cases
- Provides support for targeted content without duplicating entries
- Helps manage multi-regional or multi-brand strategies efficiently
#Use cases
Hygraph doesn’t decide which content Variant is shown to your end-users, and we don’t collect or process any end-user data to drive Segment creation. While it is possible to build personalized experiences without an additional tool, we recommend using a personalization engine for more complex setups.
Here are a few use cases that Variants support:
- Show different homepage banners to users in Germany vs. the US.
- Highlight specific content to users based on their browsing history, or the platform they come from.
- Display metric units for Europe and imperial units for the US on a product page.
- Present different introductions or visuals depending on whether the reader is a developer or a marketer.
#Get started
Prerequisites
- You have already set up a content model.
- You have created at least one content entry based on the content model.
Permissions
Variants inherit permissions from their content model. So if a user can read, create, and update a model, they have the same permissions for Variants of entries based on the model.
Limits
- Variants are an enterprise feature. Contact our sales team for access.
- You can create a maximum of 15 Variants per entry.
- Segments and Variants count toward the Content entries limits of your billing plan.
Steps
- Enable Variant support for fields.
- (Optional) Modify your Segment system model.
- Add Segments.
- Add Variants for the main entry and link the Variant to one or more Segments.
#Enable Variant support for fields
First, you need to enable Variant support on a per-field basis in your schema.
- Go to the Schema Editor, and choose your content model.
- On the Fields tab, click Edit field for the field that you want to add Variants.
- Currently, Variants are not supported for custom fields. Our team is working on adding this functionality to the feature, and we’ll share new additions in future updates.
- Under Settings, select the Enable variants check box.
- You cannot enable Variant support for unique fields.
- Click Update.
Repeat these steps for as many fields in the schema, as required.
If you disable Variant support for a field or delete a field that has Variant support enabled, the field and its associated content is removed from all Variants.
#(Optional) Modify your Segment system model
The Segment system model includes certain fields, by default. You can add more fields to the Segment model from the Field Types sidebar. Currently, Variants are not supported for custom fields. You cannot localize the fields of the Segment model.
#Add a Segment
Next, add Segments to display content from different Variants.
- In the Content Editor, under Variants, go to Segments.
- Select Add entry.
- Provide the name of the Segment and optionally, add a description.
- Click Save or Save & publish.
Repeat the above steps to add multiple Segments.
#Add a Variant and link it to a Segment
- Go to the Content Editor, and open your content entry. This is the main content entry.
- In the right sidebar, under Variants, select Add. A new version of the content entry is displayed. The values from the main entry for the default locale are copied into the Variant entry. This makes it easier to make adjustments, especially when the Variant only differs slightly from the main entry.
- To add a new locale to the Variant, in the right sidebar, under Localizations, click the
+icon next to the locale. The empty localized fields appear and you can enter the localized text for the Variant in these fields.
- To add a new locale to the Variant, in the right sidebar, under Localizations, click the
- Only the fields that have Variant support enabled are available for editing. Make changes to the available fields, as required.
- Turn on the Show all fields toggle to view the rest of the fields in the content model in read-only mode. If you want to edit the read-only fields, you need to go back to the content entry.
- Now, click Select segment.
- Choose one or more Segments that this Variant applies, and click Add selected entries.
- Click Save or Save & publish.
You need to publish the Segment to the same stage as the Variants to see Variants of a certain Segment.
#Modify a Variant
After you save a Variant, you can modify the values in different fields of the Variant. You can also modify the Segments that you linked to this Variant.
- Link more Segments - Select the Segment that you added, and click Add segment.
- Unlink a Segment - Hover over the context menu next to a Segment, and click Remove.
#Behavior of Variant fields
Each variant maintains its own values independently. If the same content is needed across entries, you need to manually update it in each entry. When working with variant fields, note the following points:
- Main entry updates: Updating a variant-enabled field in the main entry does not update the same field in its variants.
- Variant Entry updates: Changes made to variant fields do not affect the corresponding fields in the main entry.
Publishing the main entry doesn’t auto-publish its variants. You need to publish each variant separately. To be able to publish a variant, you must have already published the main entry.
#Next steps
Use Hygraph's Variants to achieve personalization in your setup, whether you are just starting out or already have a personalization engine or a Customer Data Platform (CDP) in your setup.
You need to identify user Segments in real time, and then dynamically deliver content based on the Variants that you set up in Hygraph.
#Related docs
- API reference for Variants - API reference document on fetching Variants and Segments.
- Set up live preview for Variants - Learn how to set up live preview for you Variants after you've set up a preview for your main content entry.
- Achieve Personalization with Hygraph's Variants - Learn how to combine variants and segments to create personalized content experiences.
- Set up personalization with Hygraph's Variants and frontend logic - Practical guide to implement variant-based personalization in your frontend application.
- Create Variants of content entries - As an editor, learn how to create and edit variants from the main content entry.