Embeds
![Email Embeds](/platform/email/embeds/email_embeds.webp)
Basics #
These are used to embed recommendations directly into any email within any email client. It is the easiest and most flexible way to improve existing email flows using Clerks AI.
Embedded email recommendations consist of a Content where you configure the name, product logic and other settings, and a Design that controls the look and feel of the recommendations.
Once you have configured your Content and Design, you can simply copy-paste the embedcode into your email platform, to show results at that placement.
Configuration #
Each embedded email recommendation has a number of settings that allows you to match it to your unique email setup.
Product logics #
Email comes with a large set of Product Logics that you can use to show recommendations.
They range from broad, like Best Sellers or Hot Products, to completely personalised ones like Recommendations Based On Orders. Product Logics are configured on the Content page of an embedded email recommendation.
E-mail Platform #
Clerk has integrations with a wide array of e-mail platforms. For embedded recommendations, the integrations are used to pull two specific pieces of information from the email client, through merge tags:
- The email address of the recipient, for personalising with specific product logics.
- A cachebuster that adds a unique value for each email sent, to avoid caching, which will otherwise show the same products in multiple emails.
By choosing your platform from the list, these merge tags are added to the embedcode automatically.
If your email platform is not already part of list of integrations, simply choose Other and add the merge tags manually.
Extra arguments #
Some logics require you to add extra information, like category IDs or keywords, which are added in the Insert into e-mail tab.
![Extra arguments](/platform/email/embeds/extra_arguments.webp)
Embedcode #
When a user opens an email containing an embedcode, a call is made to Clerks API to fetch the products, which are rendered through the design you have configured in a headless browser, and returned as an image to be displayed in the email.
Structure #
Below is an example of an embedcode showing 2 products. Each product consists of a link to the product page, and an image showing the product.
<center>
<a class="clerk-email-product"
href="https://api.clerk.io/v2/campaigns/click?key=Ipkv9tKfxRdpLv3mpMhqxfWGNdqugE0c&embed=personalised-recommendations&email={{ email }}&n=0&v={% current_day %}{% current_month_name %}{% current_year %}&append=utm_source%3Dclerk%26utm_medium%3Demail%26utm_campaign%3Dpersonalised-recommendations%26utm_content%3Dclerk-recommendations&keywords=star%20wars"
target="_blank"
style="text-decoration: none; ">
<img src="https://api.clerk.io/v2/campaigns/embed?key=Ipkv9tKfxRdpLv3mpMhqxfWGNdqugE0c&embed=personalised-recommendations&email={{ email }}&n=0&v={% current_day %}{% current_month_name %}{% current_year %}&append=utm_source%3Dclerk%26utm_medium%3Demail%26utm_campaign%3Dpersonalised-recommendations%26utm_content%3Dclerk-recommendations&keywords=star%20wars" />
</a>
<a class="clerk-email-product"
href="https://api.clerk.io/v2/campaigns/click?key=Ipkv9tKfxRdpLv3mpMhqxfWGNdqugE0c&embed=personalised-recommendations&email={{ email }}&n=1&v={% current_day %}{% current_month_name %}{% current_year %}&append=utm_source%3Dclerk%26utm_medium%3Demail%26utm_campaign%3Dpersonalised-recommendations%26utm_content%3Dclerk-recommendations&keywords=star%20wars"
target="_blank"
style="text-decoration: none; ">
<img src="https://api.clerk.io/v2/campaigns/embed?key=Ipkv9tKfxRdpLv3mpMhqxfWGNdqugE0c&embed=personalised-recommendations&email={{ email }}&n=1&v={% current_day %}{% current_month_name %}{% current_year %}&append=utm_source%3Dclerk%26utm_medium%3Demail%26utm_campaign%3Dpersonalised-recommendations%26utm_content%3Dclerk-recommendations&keywords=star%20wars" />
</a>
</center>
Links use calls to campaigns/click
which routes the customer through Clerk’s tracking system, and then to the product page.
Images use calls to campaigns/embed
which returns the image to be displayed in the email.
Parameters #
These are the data points used in the API calls:
Parameter | Description |
---|---|
key | The Stores API key |
embed | A reference to the ID of the content you created |
email | The recipient’s email address, added by your email platform through a merge tag |
n | The position of the product in the list of recommendations, starting at index 0 |
v | The cachebuster, e.g. a timestamp or campaign ID to avoid caching. |
append | Additional parameters that should be included as query parameters when Clerk routes the user to the product page. By default these are UTM codes used for Google Analytics tracking. |
keywords | Only added for keyword recommendations, this contains the URL-encoded keywords use to show the recommendations. |
category | Only added for category recommendations, this contains the ID of the category to show products from. |
products | Only added for Best Cross-Sell and Best Alternatives, this contains the ID(s) of the product(s) to show recommendations for. |
filter | Optional argument used to add dynamic filters to the recommendations, based on our Filters feature. |
The cachebuster is necessary, because a single e-mail recommendations embedcode can be used to show products in thousands of emails, as it simply makes API calls to Clerk when the email is opened by a user.
As the image link stays the same, many email clients will cache it and show the same products instead of making the new API call. The cachebuster makes sure the e-mail clients see each email as a unique request.
Tracking #
The performance of embedded recommendations are tracked through the URL parameters included when the user is routed to the product page.
Structure #
The landing URL includes:
- Google Analytics UTM codes
- Clerks own tracking parameters that are identified by Clerk.js.
Here is an example of a URL:
https://www.theschwartz.com/?utm_source=clerk&utm_medium=email&utm_campaign=personalised-recommendations&utm_content=clerk-recommendations&clerk_product=28081&clerk_labels=Personalised+Recommendations&clerk_api=recommendations%2Akeywords&clerk_n=0&clerk_external=1&clerk_email=gAAAAABnoLO_YDvTRvfT4ed8pRIYjqQzo38JtrdwRIM-VYDuJO8awxImzfgDB3M-Jfr29WUoayvYNV4XxqixK3-bvukeYy6uDEgRfvuomLxhpVLVn6xoUPk%3D
Parameters #
The UTM parameters for Google Analytics can be tweaked to match the tracking you want in
Tracking Code
under
Insert into e-mail
, while the Clerk parameters are addded automatically in the API request to campaigns/click
.
The included parameters are:
Parameter | Description |
---|---|
utm_source | Source of the traffic, in this case, Clerk. |
utm_medium | Marketing medium, in this case, email. |
utm_campaign | Marketing campaign, based on the name of the Content. |
utm_content | Specific content piece, which is clerk-recommendations. |
clerk_product | The ID of the product clicked. |
clerk_labels | The label configured for the Content. |
clerk_api | API endpoint used for the recommendation. |
clerk_n | Position of the product in the list of recommendations. |
clerk_external | Indicates to Clerk that the product was clicked outside the webshop. |
clerk_email | Email address of the recipient as an encoded string. |