Personalization is a powerful marketing tool that helps marketing and product teams to create variants for their website pages to engage customers. Through the results of these experiments, they can gauge which variations work best so that the overall customer experience can be enhanced.
git clone https://github.com/contentstack/contentstack-reactjs-personalization.gitPersonalization is a powerful marketing tool that helps marketing and product teams to create variants for their website pages to engage customers. Through the results of these experiments, they can gauge which variations work best so that the overall customer experience can be enhanced.
No install command available. Check the GitHub repository for manual installation instructions.
git clone https://github.com/contentstack/contentstack-reactjs-personalizationCopy the install command above and run it in your terminal.
Launch Claude Code, Cursor, or your preferred AI coding agent.
Use the prompt template or examples below to test the skill.
Adapt the skill to your specific use case and workflow.
Create a ReactJS component for a contentstack-powered website that personalizes content based on user behavior. The component should display different variants of a product page for users in the [INDUSTRY] industry. Use the following [DATA] to create three distinct variants: one for first-time visitors, one for returning visitors, and one for users who have previously purchased from [COMPANY]. Ensure the component is responsive and optimized for performance.
```markdown
# ReactJS Contentstack Personalization Component
Here's a ReactJS component that personalizes content based on user behavior for a website in the [INDUSTRY] industry:
```javascript
import React, { useEffect, useState } from 'react';
import Contentstack from 'contentstack';
const PersonalizedProductPage = ({ userData }) => {
const [content, setContent] = useState(null);
const [variant, setVariant] = useState('');
useEffect(() => {
// Initialize Contentstack
const Stack = Contentstack.Stack({ api_key: 'YOUR_API_KEY', delivery_token: 'YOUR_DELIVERY_TOKEN' });
const ContentType = Stack.ContentType('product_page');
// Determine variant based on user data
if (userData.isFirstTimeVisitor) {
setVariant('first_time');
} else if (userData.isReturningVisitor) {
setVariant('returning');
} else if (userData.hasPurchased) {
setVariant('purchased');
}
// Query Contentstack for the appropriate variant
ContentType.Query().where('variant', variant).toJSON().find().then((result) => {
setContent(result);
});
}, [userData]);
if (!content) {
return <div>Loading...</div>;
}
return (
<div className='product-page'>
<h1>{content.title}</h1>
<p>{content.description}</p>
<img src={content.image_url} alt={content.title} />
<button className='cta-button'>{content.cta_text}</button>
</div>
);
};
export default PersonalizedProductPage;
```
## Key Features
- **Dynamic Content Loading**: The component dynamically loads content from Contentstack based on the user's behavior.
- **Variant Detection**: The component detects the user's variant (first-time visitor, returning visitor, or purchased) and loads the appropriate content.
- **Responsive Design**: The component is designed to be responsive and optimized for performance.
Affordable, quality color printing and bindery services.
Communications CRM for sales automation
Dive in. Discover. Evolve. SE7EN+
Unlimited possibilities to personalize your CTA
The domain happysales.com is for sale!
AI prospecting and email campaign automation
Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan