You can use your Mautic Twig Templates not just in emails and landing pages, but also directly on your own website or share them using a special link. This lets you put personalized Mautic content anywhere on the web.

Mautic provides two ways to do this when you view a saved Twig Template:

Embed with Javascript

Add personalized Mautic content directly onto your website pages (like banners or messages). Mautic gives you a Javascript code snippet to paste into your site’s HTML.

How to Get the Code:

1

Go to your saved Twig Template in Mautic.
2

Find and click the “Embed Twig Template” option.
3

Copy the Javascript code snippet provided.

Example Snippet:

<!-- Paste this where you want the content on your page -->
<script async defer type="text/javascript"
src="https://your-mautic.com/twig/template/{TEMPLATE_ID}/{UNIQUE_HASH}.js"></script>

How it Works:

  • Paste the snippet into your website’s HTML where you want the content to appear.
  • The script fetches and displays the Twig Template’s output when the page loads.
  • Personalization is based on the visitor’s Mautic tracking cookie. If the visitor is unknown, any default values or fallback logic in your template are used.

Remember to replace https://your-mautic.com with your Mautic URL. The {TEMPLATE_ID} and {UNIQUE_HASH} are unique to your template and provided by Mautic.

Use Direct Link

Get a unique URL that displays your rendered Twig Template as a standalone HTML page.

Useful For:

  • Quickly previewing template output.
  • Embedding content using an <iframe> on another site.
  • Sharing a specific piece of personalized content directly.

How to Get the Link:

1

Go to your saved Twig Template in Mautic.
2

Find and click the “Embed Twig Template” option.
3

Copy the “Direct HTML link” provided.

Example Link:

https://your-mautic.com/twig/template/{TEMPLATE_ID}/{UNIQUE_HASH}.html

How it Works:

  • Anyone visiting this link will see the rendered HTML output of your Twig Template.
  • Personalization is based on the visitor’s Mautic tracking cookie (if they have one).

Replace https://your-mautic.com, {TEMPLATE_ID}, and {UNIQUE_HASH} with the actual values provided by Mautic for your specific template.

Using these embedding options helps you extend Mautic’s personalization power beyond emails and landing pages.