• This thread is just the tip of the iceberg.The people ahead of the curve aren't Googling for answers — they're already in here, having the conversations you haven't found yet. DealerRefresh is free.Get the full picture →

Video Email Wraps - How To

DrewAment

Boss
Apr 30, 2009
518
373
Awards
8
First Name
Drew
Had a few people ask "how" regarding http://forum.dealerrefresh.com/f44/anyone-have-experience-video-response-e-mail-928.html#post16708 , most recently from @rdpatrick on twitter. I normally just send an email, but thought I would post this here.

I do it via PHP, but is can actually be done with almost any scripting language. As all videos on YouTube are assigned a v=XXXXXXX alpha numeric number...

So to do -- Sands Chevrolet - Serving Arizona since 1934

First we have to assign a value to the variable that we have to insert later. The following code just extracts the "v" value from the URL
PHP:
<?php
$video = $_GET['v'];
?>

Now on the same PHP page we can use that variable in the URL HTML code:
PHP:
<iframe width="425" height="349" src="http://www.youtube.com/embed/<?=$video?>?rel=0" frameborder="0"></iframe>

Now just make your HTML layout/page any way you want using the iFrame code and variable video URL. You can even change the size of the video in the iframe code if you want. As all videos on YouTube are assigned a v=XXXXXXX alpha numeric number, which you can see/copy from the URL - now just put the ?v= in the URL on the page you create.

Now any link you send to a customer can have ANY video that is on YouTube embedded. So, in addition to doing personal responses, video walk-arounds, etc that you custom make, you can also embed videos from the OEM's channel -- like specials, commercials, etc.

Post questions here and I will be glad to help.
 
Last edited:
  • Like
Reactions: 1 person
I think this is a great idea.

This page doesn't appear to do anything to sanitize the variable though, so you could pass in some arbitrary HTML in the URL and it will display on the page. Adding something like
HTML:
strip_tags()
or a
HTML:
preg_replace()
would probably be a good idea. Otherwise some mischievous person could make your page look like this:

Screen Shot 2013-04-12 at 3.35.39 PM.jpg
 

✨ AI Highlights

Drew Ament explains how to create video email wraps by extracting YouTube video IDs from URLs using PHP and embedding them dynamically in emails, providing a working code example. A commenter raises an important security concern about the lack of input sanitization, noting that the code could be exploited to inject arbitrary HTML unless functions like strip_tags() or preg_replace() are added. The thread demonstrates a useful marketing technique while highlighting a critical best practice consideration for implementation.

Replies Views 5 3,214 Started Last Reply