Take your embedded editor integration to the next level with these advanced features and customization options.
Pass custom data through the embed that will be sent to your webhooks, enabling you to track user context and trigger specific workflows.
Metadata must be base64-encoded JSON and passed as a URL parameter:
projectId: "project-456",
workflowType: "marketing_campaign",
campaignId: "campaign-001"
const encodedMetadata = btoa(JSON.stringify(metadata));
// Create embed URL with metadata
const embedUrl = `https://app.templated.io/editor?embed=${configId}&metadata=${encodedMetadata}`;
document.getElementById('editor-embed').src = embedUrl;
"projectId": "project-456",
"clientId": "client-789",
"workflowType": "marketing_campaign",
"campaignId": "campaign-001"
encoded_metadata = base64.b64encode(
json.dumps(metadata).encode('utf-8')
embed_url = f"https://app.templated.io/editor?embed={config_id}&metadata={encoded_metadata}"
'projectId' => 'project-456',
'clientId' => 'client-789',
'workflowType' => 'marketing_campaign',
'campaignId' => 'campaign-001'
$encodedMetadata = base64_encode(json_encode($metadata));
$embedUrl = "https://app.templated.io/editor?embed={$configId}&metadata={$encodedMetadata}";
Generate metadata dynamically based on user context:
function generateEmbedWithMetadata(user, project) {
projectName: project.name,
timestamp: new Date().toISOString(),
source: 'project_dashboard',
permissions: user.permissions,
subscription: user.subscription.plan
const encodedMetadata = btoa(JSON.stringify(metadata));
return `https://app.templated.io/editor?embed=${EMBED_CONFIG_ID}&metadata=${encodedMetadata}`;
const embedUrl = generateEmbedWithMetadata(currentUser, currentProject);
document.getElementById('template-editor').src = embedUrl;
Pre-populate Template Data
Launch the editor with custom layer data to pre-populate templates with user-specific content.
Layer Data Structure
text: "Custom text content",
image_url: "https://example.com/user-photo.jpg"
const encodedLayers = btoa(JSON.stringify(layerData));
Template with Custom Data
src="https://app.templated.io/editor/TEMPLATE_ID?embed=CONFIG_ID&layers=ENCODED_LAYER_DATA"
Dynamic Layer Population
function createUserProfileTemplate(user) {
image_url: user.profilePicture
image_url: user.company.logo
fill: user.company.brandColor
const encodedLayers = btoa(JSON.stringify(layers));
return `https://app.templated.io/editor/${USER_PROFILE_TEMPLATE_ID}?embed=${EMBED_CONFIG_ID}&layers=${encodedLayers}`;
function createCampaignTemplate(campaign) {
color: campaign.theme.primaryColor
"campaign-description": {
text: campaign.description,
image_url: campaign.heroImage
background: campaign.theme.buttonColor
image_url: campaign.brand.logo
const encodedLayers = btoa(JSON.stringify(layers));
return `https://app.templated.io/editor/${CAMPAIGN_TEMPLATE_ID}?embed=${EMBED_CONFIG_ID}&layers=${encodedLayers}`;
Render Editing
Allow users to edit existing renders, automatically creating template clones for safe editing.
Edit Existing Render
src="https://app.templated.io/editor?embed=CONFIG_ID&render=RENDER_ID"
Integration Example
function editRender(renderId, userId) {
originalRenderId: renderId,
const encodedMetadata = btoa(JSON.stringify(metadata));
const embedUrl = `https://app.templated.io/editor?embed=${EMBED_CONFIG_ID}&render=${renderId}&metadata=${encodedMetadata}`;
// Open in modal or new window
openEditorModal(embedUrl);
document.querySelectorAll('.edit-render-btn').forEach(btn => {
btn.addEventListener('click', (e) => {
const renderId = e.target.dataset.renderId;
editRender(renderId, currentUser.id);
Template Filtering by Folder
Limit template selection to specific folders:
<!-- Show only templates from specific folder -->
src="https://app.templated.io/editor?embed=CONFIG_ID&folder=FOLDER_ID"
Editor Event Monitoring
constructor(embedElement) {
this.embed = embedElement;
this.setupEventListeners();
this.embed.addEventListener('load', () => {
console.log('Editor loaded successfully');
this.trackEvent('editor_loaded');
this.embed.addEventListener('error', (e) => {
console.error('Editor failed to load:', e);
this.trackEvent('editor_error', { error: e.message });
trackEvent(eventName, data = {}) {
// Send to your analytics
analytics.track(eventName, {
timestamp: new Date().toISOString(),
embedConfigId: this.getConfigId()
// Show fallback UI when editor fails to load
const fallback = document.createElement('div');
fallback.className = 'editor-fallback';
<div class="fallback-message">
<h3>Editor temporarily unavailable</h3>
<p>Please try refreshing the page or contact support.</p>
<button onclick="location.reload()">Refresh Page</button>
this.embed.parentNode.replaceChild(fallback, this.embed);
const url = new URL(this.embed.src);
return url.searchParams.get('embed');
const editorEmbed = document.getElementById('template-editor');
const monitor = new EditorMonitor(editorEmbed);
Best Practices for Advanced Features
Security:
- Always validate metadata on your server
- Sanitize user inputs before encoding
- Use HTTPS for all embed URLs
Performance:
- Implement lazy loading for multiple editors
- Preload resources when appropriate
- Monitor and optimize embed load times
User Experience:
- Provide loading states and error fallbacks
- Implement responsive design
- Test across different devices and browsers