How to create new custom block in Content Builder
Salesforce Marketing Cloud (SFMC), you can create custom content blocks in Content Builder using Custom HTML Blocks or by using CloudPages and AMPscript for more advanced use cases. These blocks can include personalized content, dynamic HTML, and even custom code to integrate external systems or data.
Steps to Create a Custom Block in Content Builder
- Using a Custom HTML Block
A Custom HTML Block allows you to create a custom block using your own HTML, CSS, and JavaScript (for advanced use cases). Here’s how to create a custom block using HTML in Content Builder:
Step-by-Step Process:
- Go to Content Builder:
- Navigate to Email Studio → Content Builder.
- Create New Block:
- In the Content Builder workspace, click on Create.
- Choose HTML Block from the options (this will allow you to enter custom HTML, CSS, and JavaScript).
- Add Your Custom HTML Code:
- In the HTML editor, you can now write your custom HTML code. You can also include CSS for styling and JavaScript (if required, though be mindful that JavaScript is not supported across all email clients).
Example custom block code:
<table style=”width: 100%; background-color: #f4f4f4; padding: 20px;”>
<tr>
<td style=”text-align: center;”>
<h2 style=”color: #333;”>Exclusive Offer for You!</h2>
<p style=”color: #555;”>As a valued customer, you’re eligible for a special discount.</p>
<a href=”%%=RedirectTo(‘http://yourwebsite.com/offer’)=%%” style=”background-color: #28a745; color: white; padding: 15px 30px; text-decoration: none; border-radius: 5px;”>Claim Your Offer</a>
</td>
</tr>
</table>
- You can use AMPscript or Personalization Strings to inject subscriber-specific content dynamically (e.g., %%FirstName%%, %%emailaddr%%).
- After adding your custom code, click Save.
- Give the block a name and description, so it’s easier to locate later.
- Once saved, you can drag and drop this Custom HTML Block into your email template or drag it directly into an email you’re building in Content Builder.
- Using CloudPages for Advanced Custom Blocks
If you need more dynamic functionality, like integrating external APIs, adding interactive elements, or using advanced AMPscript (e.g., conditional logic, custom personalization), you can build custom blocks on CloudPages.
Here’s a high-level overview of the process:
Step-by-Step Process:
Example of AMPscript within a CloudPage:
%%[
VAR @FirstName
SET @FirstName = AttributeValue(“FirstName”)
]%%
<h2>Hello %%=v(@FirstName)=%%, Welcome Back!</h2>
<p>We’re happy to offer you a special deal today!</p>
- Publish the CloudPage:
- Once you’ve added your custom HTML, AMPscript, or JavaScript, publish the CloudPage.
- You can use the URL of the CloudPage to link it from within an email in Content Builder or use it as part of a dynamic content block.
- Link CloudPage to Email:
- Once you have created your CloudPage, you can reference it as a custom block in emails.
- For example, include the CloudPage’s URL in your Call-to-Action buttons or links.
- Custom Content Blocks with SFMC’s Marketing Cloud SDK
If you’re building highly custom content blocks that involve third-party integrations, such as pulling external data, or need advanced logic, you can also create custom content blocks using Marketing Cloud SDK. This is more developer-centric and allows you to extend the functionality beyond what’s available in the standard SFMC interface.
- Using a Custom Content Block with Dynamic Content
Sometimes, content blocks are “custom” in the sense that they adapt based on the audience or segmentation. These are typically built using Dynamic Content features in SFMC.
Example of Dynamic Content Block:
- Create a Dynamic Content Block:
- In Content Builder, drag the Dynamic Content Block to your email template.
- Set Rules for Dynamic Content:
- You can define rules based on subscriber attributes (e.g., different content based on the Loyalty Tier, Location, Past Purchases, etc.).
- Add different content for different conditions within the same content block. For example, a “Gold” tier subscriber may see a different promotion than a “Silver” tier subscriber.
Example rule setup:
%%[
VAR @LoyaltyTier
SET @LoyaltyTier = AttributeValue(“Loyalty_Tier”)
IF @LoyaltyTier == “Gold” THEN
SET @offerText = “20% Off Your Next Order!”
ELSEIF @LoyaltyTier == “Silver” THEN
SET @offerText = “15% Off Your Next Order!”
ELSE
SET @offerText = “10% Off Your Next Order!”
ENDIF
]%%
<p>Your personalized offer: %%=v(@offerText)=%%</p>
3.Save and Reuse:
- You can save dynamic content blocks for future campaigns.
- Use them across multiple emails, ensuring that the right content is displayed to the right audience.
- Best Practices for Custom Blocks
- Testing: Always test your custom blocks across different email clients to ensure compatibility (especially with custom HTML, CSS, and AMPscript).
- Use Modular Components: When creating custom blocks, think modular. Break down your blocks into smaller, reusable parts (e.g., headers, footers, product recommendations).
- Optimize for Mobile: Always ensure your custom blocks are responsive, as emails often need to look good on a wide range of screen sizes.
Conclusion
Creating custom content blocks in Salesforce Marketing Cloud provides you with the flexibility to personalize and dynamically adjust your emails based on user attributes, behaviors, or other external data sources. Whether you’re building simple HTML blocks for quick adjustments or using CloudPages for more complex, dynamic content, SFMC offers a wide range of options to make your email marketing more engaging.