# Vimeo Embeds With "Do Not Track"

> Adds Vimeo's dnt=1 setting to every embedded Vimeo video, which stops Vimeo from setting tracking cookies or collecting session data for your visitors.

- Type: PHP
- Runs: Run everywhere
- Category: [Privacy & Cookies](https://wpide.com/library/category/privacy/)
- Tags: vimeo, embeds, tracking
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/privacy-vimeo-do-not-track/

## Code

```php
add_filter( 'oembed_fetch_url', function ( $provider ) {
    return false !== strpos( $provider, 'vimeo.com' ) ? add_query_arg( 'dnt', '1', $provider ) : $provider;
} );

add_filter( 'embed_oembed_html', function ( $html, $url ) {
    if ( false === stripos( $url, 'vimeo.com' ) || ! class_exists( 'WP_HTML_Tag_Processor' ) ) {
        return $html;
    }

    $tags = new WP_HTML_Tag_Processor( $html );

    while ( $tags->next_tag( 'iframe' ) ) {
        $src = (string) $tags->get_attribute( 'src' );
        if ( false !== strpos( $src, 'player.vimeo.com' ) ) {
            $tags->set_attribute( 'src', add_query_arg( 'dnt', '1', $src ) );
        }
    }

    return $tags->get_updated_html();
}, 10, 2 );
```

## Notes

Vimeo still sees the visitor's IP address when the player loads; combine with a click-to-load snippet if you need to avoid that too.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Vimeo Embeds With "Do Not Track"" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
