Product Updates + Strategy

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

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>
What Is RebelMouse?
Request a Proposal

Where 
Websites Are Built

The Fastest Sites in the World Run on RebelMouse

Let’s Chat

new!

RebelMouse Performance Monitoring

Real-Time Core Web Vitals

Get Started
DISCOVER MORE

Our Core Features

Our platform is a complete digital publishing toolbox that's built for modern-day content creators, and includes game-changing features such as our:

animate
Layout and Design toolLayout and Design tool on mobile
animate

Why RebelMouse?

Unprecedented Scale

RebelMouse sites reach more than 120M people a month, with an always-modern solution that combines cutting-edge technology with decades of media savvy. And due to our massive scale, 1 in 3 Americans have visited a website powered by RebelMouse.

120M+ Users
550M+ Pageviews
17+ Avg. Minutes per User
6+ Avg. Pages per User

Today's Top Websites Use RebelMouse

Thanks to the tremendous scale of our network, we are able to analyze a wealth of traffic data that informs our strategies and allows us to be a true strategic partner instead of just a vendor.

upworthyindy100Vault12No Film SchoolRawStoryResponsible StatecraftPrideRolling Stone QuebecPremierGuitarPenskeINN Educate Brand ConnectThe FulcrumGZEROOkayafricaBrit+CoPaper MagazinePowerToFlyNarcityCommonDreamsAllBusiness

What Clients Say

We’re here to help you weigh and understand every tech and strategic decision that affects your digital presence. Spend less time managing everything yourself, and more time focused on creating the quality content your users deserve.

Case Studies

A Team Built Like No Other

RebelMouse employs a unique, diverse, and decentralized team that consists of 70+ digital traffic experts across more than 25 different countries. We have no central office, and we cover every time zone to ensure that we’re able to deliver amazing results and enterprise-grade support around the clock.

Our team is well-versed in all things product, content, traffic, and revenue, and we strategically deploy ourselves to help with each element across all of our clients. We thrive on solving the complex.

Let's Chat