Subscribe to Our Newsletter

x

How to Fix the Post Preview Bug Due to Connatix Video Ads

Some users have reported that when previewing a post in the Entry Editor with a Connatix video ad embedded, the video takes over the entire screen like in the following example:


The goal of this tutorial is to show you how to fix this issue. This should make the Connatix video embed normally in the post preview, the same way it should appear in the post after publishing. The result will be a preview that looks like the following:

In order to do this, Connatix suggested to us that users add a parameter in the ad that is then added dynamically just for the post preview. The parameter you need to add to the preview is the following string:

    preserve-iframe=1

The first global solution is to go into the Layout & Design tool and, from the Post page, insert the following code:

    <choose>
        <when test="getparams.draft=='1'">
         <write_to_header data-rm-friendly-name="Connatix Preview" data-rm-selected="true">
          <![CDATA[<script async type='text/javascript'
    src='https://cdn.connatix.com/min/connatix.renderer.infeed.min.js'
    data-connatix-token='902fce37-9cb7-4fb0-8307-fa65ef7168ef' preserve-iframe='1'>
          </script>]]>
         </write_to_header>
        </when>
         <otherwise>
          <write_to_header data-rm-friendly-name="Connatix">
           <![CDATA[<script async type='text/javascript' 
    src='https://cdn.connatix.com/min/connatix.renderer.infeed.min.js?production'
    data-connatix-token='902fce37-9cb7-4fb0-8307-fa65ef7168ef'>
           </script>]]>
          </write_to_header>
         </otherwise>
        </choose>

The code should be placed as the first block in the Post page as shown below:

However, this solution doesn't work when your advertisement/script is included by the Ad Manager (after x number of words).

To fix this, you can include a script in the Ad Manager itself to include the preserver-iframe=1 parameter dynamically there. You should include an ID in your advertisement script (located toward the end of the following code snippet):

    <script async type='text/javascript'
        data-src='https://cdn.connatix.com/min/connatix.renderer.infeed.min.js'
        data-connatix-token='a928293d-a011-457c-b7d7-1346b0ce87c3' id="post-{{post.id}}">
    </script>

After that, you can include the following piece of code in your Top Bar (so that the fix is always applied). This will only include the parameter fix when you're in a post draft.

    <script>
        var post = document.getElementById('post-{{post.id}}');
        var url = new URL(window.location.href);
        if (url.searchParams.get('draft')) { 
            post.setAttribute('preserve-iframe', 1); 
        } else { 
            post.src = post.getAttribute('data-src'); 
        }
    </script>

How to Include Interactive Elements in Posts

Enhance your articles with rich and creative media

Every article is a fresh chance to grab new readers and nurture loyal followers. This is why we give creators every opportunity to build content rich with media elements that enhance every reader's experience.

Add More Layers to Your Content

You can easily add interactive elements, like charts, to posts on our platform. For example, if you need to embed iframe code into a post, this can be done via our Add Media Bar. To do so, click the code icon (< >):

A text box will appear so you can insert your code:

Embedded Code Across Platforms

One important thing to keep in mind is that Google AMP, AppleNews, and Facebook Instant Articles will not always support embedded code. So if you use an iframe, it's best to turn off distribution to those channels for that particular post. If you have a lot of posts that require embedded code, this could be problematic for growth across those important platforms.

If you do want to use an iframe on a post destined for Google AMP distribution, it can be possible if the iframe is not at the top of the page or within the first 75% of the viewport when the page is scrolled to the top (whichever is smaller). AMP is a fast technology designed for mobile users and iframes are loaded using arbitrary timing that AMP's technology cannot ensure. For this reason, it's suggested that iframes be included in places that are not visible by users upon load.

If you have an article that needs to include an iframe at the top of the page, or within the first 75% of the viewport, AMP can be turned off for that individual article within Entry Editor.

If you don't need an interactive chart to be interactive in nature, can turn it into an image and upload it directly to your post. This way it will work on all platforms, including Google AMP, Apple News, and Facebook Instant Articles. This option, when possible, is ideal to ensure you're optimized for page speed.

Take Advantage of Shortcodes

Another great way to embed media is through our shortcodes functionality. Click here to learn more about shortcodes. Shortcodes can also inserted using the Add Media Bar. Click the brackets icon ([ ]) to choose the shortcode you want to use.

Here's an example of a chart on an article page that's been inserted using a shortcode:

If you have any questions about how to add interactive elements to your content, please email support@rebelmouse.com or talk to your account manager today.

Shortcodes Dashboard: Dynamic Media in Just a Few Clicks

Create multidimensional content with easy-to-find shortcodes

We believe static media is dead, and that every piece of content should be multidimensional and engaging. This is why our platform enables creators so they can add dynamic media to their content in easy and efficient ways.

One simple way to add interactive content to any post is through the use of shortcodes. Shortcodes are small snippets of code that are easier to remember than longer sequences. They typically will activate a feature or embed media into an article.

Keep reading... Show less
Subscribe to Our Newsletter