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>

You're almost there! Fill out the form below and a Rebel will contact you within one business day.

x

Changing the World on Behalf of Millennial Mothers

Motherly is a new media property redefining motherhood. Created by women for women, their mission is one of empowerment to support women on their unmatched journey to mommyhood. Founded in 2015 by serial entrepreneur Jill Koziol and award-winning Washington Post digital strategist Liz Tenety, Motherly leads the effort in curating female-driven content that builds strong communities through the power of dynamic, multiplatform storytelling.

Keep reading... Show less

You're almost there! Fill out the form below and a Rebel will contact you within one business day.

x

NEW! End of Summer 2018 Product Updates

It's almost the end of summer 2018 and we have some awesome product updates to announce! Here's what's new: scheduling posts to be unpublished, a copyright option for Facebook Instant Articles, Keywee and Parse.ly integrations for Facebook Instant Articles, parent/child relationships for sections in the dashboard, a scheduled filter for community-enabled dashboards, and a Google Search Console integration for the Entry Editor. There's a lot to unpack here, we know! So continue on below for more details on each announcement.

Keep reading... Show less