Web Tactic Embed Guide

This guide explains how to test your website's compatibility with Web Tactics, add the embed code generated by Studio, and verify that your Tactic renders, resizes, and personalizes on your page.

Studio generates embed code for each Deployment of a published Web Tactic. The code creates an iframe on your website that displays your Tactic and supports personalization, responsive layouts, and interactive content.

You can use a fixed URL or a dynamic URL from a data source or Dynamic Field. Each link requires an Analytics ID, which identifies the link in reporting.

For information about creating and designing Tactics, see Create Web Tactics.


Before you begin

Make sure you have:

  • A published Web Tactic and Deployment. Studio generates embed code for each Deployment. See Publish and deploy Tactics.
  • Access to your website or CMS. You must be able to edit the page or template where the Tactic appears.
  • Permission to add HTML and JavaScript. Your website or CMS must allow custom HTML and <script> elements on the page.
  • A test environment. Use a staging or test page to verify the integration before you publish it to your live website.
  • The Behavior Tracking Script (if required). If your Web Tactic uses recorded browsing activity, confirm that the required behavioral data is available. For instructions on collecting website activity, see Set up behavior and conversion tracking in Studio.


How Web Tactics work on your website

Web Tactics display inside an iframe, an area of a web page that loads content from another source. The embed code from Studio has two components:

Component Purpose
HTML container Defines where the Web Tactic appears on your page.
JavaScript Creates the iframe, loads the Tactic, and manages communication between the Tactic and your website.

When a visitor opens your page, the embed code loads the Tactic into the container.

After you embed a Web Tactic on your website, you can continue to update its content and design in Studio. Most routine changes, such as editing text or replacing an image, don't require new embed code.

Some changes may require you to create a new Deployment and replace the embed code on your website. Before making changes that could affect your website integration, contact your Client Experience Manager to confirm whether new embed code is required.


Step 1: Test your website's compatibility

Before you embed your own Web Tactic, use sample Movable Ink content to verify that your website or CMS supports the integration. The test verifies that your website:

  • Loads and displays Movable Ink content.
  • Opens links in the content.
  • Adjusts the layout for different screen sizes.
  • Passes URL parameters to the content to personalize it.

If you have already completed these tests on your website, skip to Step 2.

Add sample content to a test page

  1. Create a test page in your CMS or staging environment.
  2. Copy the sample embed code below.
  3. Paste the code where you want the sample content to appear.
  4. Save and publish the page to your staging environment.
  5. Open the published page in a browser.

The sample code includes a Movable Ink test URL. Don't change the URL or replace any text in it, including %%_emailname%%.

Sample embed code:

loadMovableIframe(
    'https://www.ink1001.com/p/tp/f5e1352c15858295/' +
    'personalized-image-web-hero-block.html?' +
    'mi_ecmp=%%_emailname%%:&id=abandonun',
    "mi-content"
);

The sample content appears on your test page.

Embed Code Example.png

Test the sample content

Run each test and note whether it passes or fails.

Test What to do Expected result
Content loads Open the test page in a browser. The complete sample content appears.
Links Click the Movable Ink logo in the sample content. The browser opens https://movableink.com/.
Responsive layout Reduce the browser width to less than 768 pixels. The content stacks to fit the smaller screen.
Dynamic content Add the id parameter to the page URL (see below). The displayed dollar amount changes from $0 to match the parameter value.

Test URL-based personalization

The sample content uses the id parameter in the page URL to determine which dollar amount to display. If your test page is at https://www.example.com/test, open it with these URLs:

Test URL Expected amount
https://www.example.com/test $0
https://www.example.com/test?id=sa1 $10
https://www.example.com/test?id=sa2 $20

Replace the example domain and path with your actual test page URL. If your page URL already contains query parameters, add &id=sa1 or &id=sa2 instead of starting a new query string with ?. For example:

https://www.example.com/test?campaign=spring&id=sa1

The embed code reads the id parameter from your page URL and passes it to the Movable Ink content. If the amount changes to $10 and $20, URL-based personalization works.

Note: These tests confirm only that the sample content works on your website. They don't test your own Web Tactic. You test your Tactic in Step 4.

 

If any test fails, see Troubleshooting below, for a list of common issues and their solutions.


Step 2: Copy the embed code from Studio

After the Step 1 tests pass, copy the embed code for the Tactic you want to display.

  1. In Studio, open the Deployment for your published Web Tactic.
  2. Copy the generated embed code.

Important: Use the embed code generated for your own Web Tactic. The sample code in Step 1 is for compatibility testing only and loads sample Movable Ink content.

If your existing embed code doesn't contain mi_content_height, it predates automatic height adjustment. Replace it with the latest code from your Deployment. You replace the code once.

Publish your website changes and confirm that the Tactic displays correctly in production. You can continue to manage routine content updates in Studio. If subsequent changes require new embed code, create a new Deployment, replace the code on your website, and test the updated integration. For instructions on creating a Deployment, see Publish and deploy Tactics.

 

Step 3: Add the Web Tactic to your website

In this step, you add the embed code from Step 2 to the page or template where the Tactic appears.

Add the embed code

  1. Open the page or template in your CMS or code editor.
  2. Add the HTML container from your Deployment's embed code where you want the Tactic to appear.
  3. Add the JavaScript from your Deployment directly below the container.
  4. Set the parent container's width and height, or let Studio control the height. See Configure the Tactic's height.
  5. Save your changes and publish the page to your staging environment.

When the page loads, the JavaScript creates an iframe inside the HTML container and loads your Web Tactic.

Embed multiple Web Tactics on a page

If you plan to display multiple Web Tactics on the same page, contact your Client Experience Manager to confirm whether additional embed code configuration is required.

Test all Tactics together in your staging environment to confirm that each displays, resizes, personalizes, and responds to visitor interactions as intended.

Configure the Tactic's height

The parent container determines the space available for your Web Tactic. Choose who controls the height:

Option When to use it Configuration
Website-controlled height Your layout needs a specific height for the Tactic. Define the parent container's height in your website's HTML or CSS.
Studio-controlled height You want the height to adjust to the Canvas being displayed. In Designer, go to Creative Settings → HTML Base and enable Parent Container Has No Height.

If your Tactic uses additional responsive design settings, such as Scale Content or Overflow Scroll, test the Tactic within its website container to confirm that the content displays and behaves as intended.

For more information about responsive design settings, see Create Web Tactics.

Important: If your website doesn't define a container height and Parent Container Has No Height isn't enabled, the iframe uses the browser's default height of 150 pixels and cuts off your Tactic's content.

Support interactive content

Web Tactics support interactive elements such as Live Polls, questionnaires, Scratch Off experiences, and links. For these elements to work, the iframe must receive pointer events. Don't set pointer-events: none on the iframe, and don't place other elements over it.

Web Tactics in carousels

If your Tactic appears in a website carousel, you must complete two additional steps to support swipe and drag gestures:

  1. In Designer, go to Creative Settings → HTML Base and enable Pointer Relay.
  2. Configure your website to receive Pointer Relay messages and use them to control the carousel.

For implementation instructions, see Configure Pointer Relay for Web Tactics in carousels


Step 4: Test your Web Tactic

After you embed your Tactic, test it on your staging page before you publish the integration to your live website. Unlike the Step 1 sample test, these tests verify that your actual Tactic works with your website's layout, content, and personalization data.

Verify rendering and responsiveness

Confirm that:

  • The Tactic appears at the container's location on the page.
  • All text, images, and links in the Canvas are visible.
  • The iframe fills the container's width, and no content is cut off at the bottom.
  • The Canvas you designed for each breakpoint appears at the matching browser width.
  • The Tactic updates to the new width after you stop resizing the browser window.
  • Content scales proportionally when Scale Content is enabled.
  • Visitors can access content that extends beyond the visible container when Overflow Scroll is enabled.

Verify personalization

Test each personalization method your Tactic uses.

Personalization method What to verify
URL parameters Each parameter in the Tactic URL has a matching parameter in your page URL, and the Tactic displays the content for that value.
Behavioral data The _mibhv cookie is set and the Tactic displays content based on that visitor's activity, for example products they viewed. Requires the Behavior Tracking Script.
Location or weather The Tactic displays the content that matches the location or weather condition you test.

Also test how your Tactic behaves when the data required for personalization is unavailable. Depending on your implementation, this may include testing with missing URL parameters, no visitor identifier, or unavailable data source values.

Confirm that the Tactic displays the intended default experience.

Verify interactions

Test each interactive element in your Tactic:

  • Clickthrough links.
  • Live Polls and questionnaires.
  • Scratch Off experiences.
  • Swipe and drag gestures in carousels, if you configured Pointer Relay.

Publish your Web Tactic

After your Tactic passes the Step 4 tests, publish your website changes to production.


Understanding the embed code

The embed code from Studio handles the functions Web Tactics need to display and personalize content. You don't need to build these functions yourself, but understanding them helps you configure and troubleshoot your integration.

Function What it does
Creates an iframe Loads the Web Tactic inside the HTML container.
Passes URL parameters Reads matching parameters from your website URL and passes them to the Tactic.
Retrieves a visitor identifier Reads the _mibhv cookie, when the cookie is present, to get a visitor identifier for behavioral personalization.
Sets viewport width Passes the browser window width to the Tactic for responsive rendering.
Handles browser resizing Notifies the Tactic when the browser window changes size.
Adjusts iframe height Receives height information from the Tactic and resizes the iframe to fit.

Before embedding your Tactic, confirm that its generated URL includes the parameters required for personalization. Adding a parameter to your website URL alone doesn't make it available to the Tactic through the supplied parameter-forwarding logic.

Work with the team responsible for creating the Tactic in Studio to confirm the required parameter names and expected values.

URL parameters and visitor identification

The embed code reads the parameters defined in the Tactic URL, then looks for matching parameters in your website's URL. For example, if your Tactic URL includes an id parameter and a visitor opens https://www.example.com/products?id=sa1, the code passes sa1 as the id value to the Tactic. If a matching parameter isn't in the website URL, the embed code passes an empty value.

The code also handles these parameters:

Parameter Purpose
mi_u The unique user identifier. Identifies a visitor for personalization.
mi_ecmp Passes email campaign metadata from your page URL to the Tactic.
mi_viewport_width Provides the browser window width in pixels for responsive rendering.

The embed code can obtain a visitor identifier from URL parameters defined in the Tactic URL or, when available, from the _mibhv cookie.

The identifier and associated data determine which visitor-specific personalization the Tactic can support.

Work with your Client Experience Manager to confirm the visitor identification requirements for your implementation.

For more information, see Set up behavior and conversion tracking in Studio.

Communication between the website and Tactic

The embed code uses the browser's postMessage API to exchange information between your website and the Tactic's iframe. These messages support responsive rendering:

Message Direction Purpose
mi_viewport_resize Website → Tactic Notifies the Tactic when the browser width changes.
mi_content_height Tactic → Website Reports the content height to the website, which resizes the iframe.

The code waits until the browser window stops resizing for 300 milliseconds before it sends the updated viewport width. When the Tactic reports its content height, the code validates the value and confirms that the message came from the Tactic's iframe before it resizes the iframe.

Pointer Relay uses separate messages to support swipe and drag interactions in carousels. See Configure Pointer Relay for Web Tactics in carousels.


Troubleshooting

If your Web Tactic doesn't display, resize, or respond to clicks, find the symptom in the table and check the listed items.

Issue What to check
The Tactic doesn't appear. Confirm that the HTML container and JavaScript are on the published page and that the container ID matches the ID the script references. Check the browser console for errors.
The Tactic is cut off or 150 pixels tall. Check the parent container's height. Define a height in your website's CSS or enable Parent Container Has No Height in Designer. Confirm that your embed code contains mi_content_height. If it doesn't, replace it with the latest code from your Deployment.
Dynamic content doesn't change. Confirm that the Tactic URL in your embed code includes the parameter and that your page URL contains a parameter with the same name and a value.
The Tactic doesn't resize correctly. Check the parent container's width and height, the Canvas settings for each breakpoint, and the page's viewport meta tag.
Visitors can't interact with the Tactic. Check your website's CSS for pointer-events: none on the iframe and for elements that overlap it.
Behavioral personalization doesn't work. Confirm that the Behavior Tracking Script is installed and that the _mibhv cookie is set in the browser.
Carousel swiping doesn't work. Confirm that Pointer Relay is enabled in Designer and that your website handles Pointer Relay messages.

If the issue continues, contact your Customer Experience Manager. Include the URL of the page where you're testing the Tactic, a description of the issue, and any browser console errors.

 


Next steps

Publish your website changes and confirm that the Tactic displays correctly in production. After that, most content edits appear on your website after you publish a new version and update the Deployment. For the edits that need new embed code, see How Web Tactics work on your website.

To learn more about responsive layouts and personalization, see Create Web Tactics.