Embedded Spaces
If you'd like to run your Messaging campaign in your own website, app, or other location, you may create a campaign with embedded messages.
Create a New Embedded Message
Use the dashboard to add, edit, or delete a space and track performance of an embedded message. To create a campaign for an embedded space, use the Messaging feature's creation wizard. Note the settings you'll need for creating an embedded message:
- Select Embedded for the Delivery setting
- Select the message space for display
- Select a previously-created space
- Create a new space
- Set the Message type
- Banner ad
- Email Footer
- Follow the steps to set priority, add the content and link, and launch the campaign
- Copy the space code
Use the Space Code
Embedded space code is in HTML and JavaScript (see example). The campaign message can be loaded in any location able to access the user's MX user_id.
- If a Message is located in multiple places, you will need to maintain the same dimensions across locations.
- If a user is targeted for multiple campaigns, they will be displayed according to the priority set when creating the campaign.
Prerequisite: you must have onboarded with MX and have an API Key.
Example Code
_31<!-- This script loads the MDAnalytics functionality -->_31 <script_31 type="text/javascript"_31 src="https://analytics.moneydesktop.com/analytics.v1.js">_31 </script>_31_31<!-- This element is where the banner is injected -->_31 <div id="targetedMXAd" style="text-align: center;" />_31_31_31<!-- This script requests the ad for the user from MX -->_31<script type="text/javascript">_31 (function () {_31 function load() {_31 MDAnalytics.loadBanner({_31 analytics_api_key: "IssuedByMX",_31 user_id: "userIdFromRealTimeAPI",_31 element_id: "targetedMXAd",_31 default_banner_image_url: "urlOfDefaultImageToLoad",_31 default_banner_url: "urlOfDefaultClickDestination",_31 campaign_group_guid: "embeddedSpaceGuidFromDashboard",_31 });_31 }_31_31 if (document.readyState === "loading") {_31 document.addEventListener("DOMContentLoaded", load);_31 } else {_31 load();_31 }_31 })();_31</script>
Target Fields
| Field name | Description |
|---|---|
analytics_api_key | Required. Unique API key that authenticates the request on the MX Platform. |
campaign_group_guid | Required. Unique identifier of the campaign space or group that the banner belongs to. |
user_id | Required. Unique ID that identifies the user. This value is created during user creation using MX APIs. |
element_id | Required. Unique id for a placeholder HTML element that will be replaced with the ad when loaded. |
default_banner_image_url | Optional. The URL of the image banner ad that's loaded when no campaign is available to load. |
default_banner_url | Optional. The destination URL that a user is directed to when they select the banner ad when no campaign is available to load. |