Are you tired of those pesky suggested videos that appear at the end of or when pausing a Facebook video? Do you want to provide a seamless viewing experience for your audience? Look no further! In this article, we’ll show you how to hide or remove Facebook suggested videos using Facebook Embed code.
- The Problem with Suggested Videos
- Why Use Facebook Embed Code?
- Method 1: Hiding Suggested Videos Using the `show_text` Parameter
- Method 2: Removing Suggested Videos Using the `autoplay` Parameter
- Method 3: Hiding Suggested Videos Using CSS
- Method 4: Removing Suggested Videos Using JavaScript
- Conclusion
- FAQs
The Problem with Suggested Videos
Suggested videos are a great way for Facebook to keep users engaged on their platform. However, for content creators and marketers, they can be a nuisance. Not only do they distract from your content, but they can also lead to a drop in engagement and a decrease in video views. worst still, they can even drive traffic away from your website or landing page.
Why Use Facebook Embed Code?
Facebook Embed code is a powerful tool that allows you to embed Facebook videos on your website or landing page. With Facebook Embed code, you can customize the video player, add custom branding, and even track video metrics. But, did you know that you can also use Facebook Embed code to hide or remove suggested videos?
Method 1: Hiding Suggested Videos Using the `show_text` Parameter
The first method to hide suggested videos is by using the `show_text` parameter in your Facebook Embed code. This parameter controls the display of suggested videos at the end of the video. By setting `show_text` to `false`, you can hide suggested videos altogether.
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v3.2&appId=YOUR_APP_ID&autoLogAppEvents=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-video"
data-href="https://www.facebook.com/facebook/videos/10153231379946729/"
data-width="500"
data-show-text="false"></div>
In the code above, we’ve added the `data-show-text` attribute to the `div` element and set it to `false`. This will hide suggested videos at the end of the video.
Method 2: Removing Suggested Videos Using the `autoplay` Parameter
The second method is by using the `autoplay` parameter in your Facebook Embed code. This parameter controls the autoplay functionality of the video. By setting `autoplay` to `true`, you can remove suggested videos when pausing the video.
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v3.2&appId=YOUR_APP_ID&autoLogAppEvents=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-video"
data-href="https://www.facebook.com/facebook/videos/10153231379946729/"
data-width="500"
data-autoplay="true"></div>
In the code above, we’ve added the `data-autoplay` attribute to the `div` element and set it to `true`. This will remove suggested videos when pausing the video.
Method 3: Hiding Suggested Videos Using CSS
The third method is by using CSS to hide suggested videos. This method is a bit more tricky and requires some knowledge of CSS selectors and properties.
<style>
.fb-video[data-href] .fb-video-suggestions {
display: none !important;
}
</style>
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v3.2&appId=YOUR_APP_ID&autoLogAppEvents=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-video"
data-href="https://www.facebook.com/facebook/videos/10153231379946729/"
data-width="500"></div>
In the code above, we’ve added a CSS style block that targets the `.fb-video-suggestions` element and sets its `display` property to `none`. This will hide suggested videos altogether.
Method 4: Removing Suggested Videos Using JavaScript
The fourth method is by using JavaScript to remove suggested videos. This method is a bit more advanced and requires some knowledge of JavaScript and the Facebook SDK.
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v3.2&appId=YOUR_APP_ID&autoLogAppEvents=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-video"
id="my-video"
data-href="https://www.facebook.com/facebook/videos/10153231379946729/"
data-width="500"></div>
<script>
FB.Event.subscribe('xfbml.ready', function(msg) {
var videoContainer = document.getElementById('my-video');
var video = videoContainer.querySelector('.fb-video-player');
video.addEventListener('pause', function() {
var suggestions = videoContainer.querySelector('.fb-video-suggestions');
suggestions.style.display = 'none';
});
});
</script>
In the code above, we’ve added a JavaScript block that subscribes to the `xfbml.ready` event. When the event is triggered, we get a reference to the video container and video player elements. We then add an event listener to the video player’s `pause` event. When the video is paused, we get a reference to the suggested videos element and set its `display` property to `none`. This will remove suggested videos when pausing the video.
Conclusion
In conclusion, there are several ways to hide or remove Facebook suggested videos at the end or when pausing using Facebook Embed code. Whether you use the `show_text` parameter, the `autoplay` parameter, CSS, or JavaScript, the methods outlined in this article will help you provide a seamless viewing experience for your audience.
FAQs
Q: Will hiding suggested videos affect my video metrics?
A: No, hiding suggested videos will not affect your video metrics. Facebook will still track video views, engagement, and other metrics even if suggested videos are hidden.
Q: Can I use these methods to hide suggested videos on all Facebook videos?
A: No, these methods only work for videos embedded using Facebook Embed code. If you’re using a third-party video player or iframe, these methods may not work.
Q: Are there any other ways to customize Facebook Embed code?
A: Yes, there are many other ways to customize Facebook Embed code, including adding custom branding, changing the video player size, and adding captions. You can find more information on the Facebook Developer website.
Method | Description |
---|---|
Method 1: Hiding Suggested Videos Using the `show_text` Parameter | Uses the `show_text` parameter to hide suggested videos at the end of the video |
Method 2: Removing Suggested Videos Using the `autoplay` Parameter | Uses the `autoplay` parameter to remove suggested videos when pausing the video |
Method 3: Hiding Suggested Videos Using CSS | Uses CSS to hide suggested videos altogether |
Method 4: Removing Suggested Videos Using JavaScript | Uses JavaScript to remove suggested videos when pausing the video | Frequently Asked Question