The best way to get the best DMCA protection badge

ARTRU
The best way to get the best DMCA protection badge

Perhaps not many of you pay attention to speed or SEO issues after affixing the DMCA protection badge on your website.

Error when attaching DMCA protection badge

Here is the code that the DMCA tells you to attach to the web:

Embed Your Badge DMCA
Embed Your Badge DMCA

Try to visit PageSpeed Insights to check if your website has any errors related to DMCA.

Error DMCA image has no clear width, height
Error DMCA image has no clear width, height

If the user uses an ad blocker extension, the DMCA image cannot be loaded.

Error of DMCA badge not loading
Error of DMCA badge not loading

Bug fixes and DMCA badge optimization

You need more attributes width height for card <img>.

The DMCA protection badge is usually located at the bottom of the page. So you can set more attributes loading="lazy".

You should always save the image of the DMCA badge on your website to avoid errors when users use an ad blocker.

Add attribute for DMCA img tag
Add attribute for DMCA img tag

File <script> It's actually just a JavaScript code that adds the function to the tag's tail <a href part &refurl={url}. {url} is the url of the current page.

Instead of using JavaScript code you can write it directly with the function get_permalink() in WordPress.

Here's how I use the DMCA protection badge:

<a target="_blank" href="https://www.dmca.com/Protection/Status.aspx?ID=f403b2c1-8e2d-4993-8c7a-2d7da934eb4c&refurl=<?php echo get_permalink(); ?>" class="dmca-badge">
	<img loading="lazy" width="100" height="20" src ="https://cdn.artru.io.vn/wp-content/uploads/2023/07/dmca-badge.png" alt="DMCA.com Protection Status" />
</a>

In case you use the source code PHP pure, you can use the function like this:

function get_permalink() {
    $protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https://' : 'http://';
    $host = $_SERVER['HTTP_HOST'];
    $uri = $_SERVER['REQUEST_URI'];
    return $protocol . $host . $uri;
}
$current_permalink = get_permalink();
echo $current_permalink;
COMMENT

Related Articles