0

Youtube offers you the ability to create embeddable subscribe buttons. Is there a way that I could create a button like this, and embed it on my website, but code it in such a way that it will redirect to a specific url after a person clicks the subscribe button?

Here is an example of the code they offer.


<div class="g-ytsubscribe" data-channelid="UCAJZEjGwmVEDN2hmlT-v8Pg" data-layout="default" data-count="default"></div></center>```

I am not much of a coder so please explain in the simplest terms possible. 

Thanks in advance for any help anyone can offer.



1 Answers1

1

This will not be possible with YouTube's solution - they intentionally do not include any redirection abilities, most likely for security purposes. Being able to conditionally redirect users after they subscribe is a small but extremely powerful privilege.


However, instead of trying to redirect after they subscribe, how about opening your channel in a new tab? Design a similar-looking 'Subscribe' button and link it to your channel. After being pressed, you could then, after 5-10 seconds, programmatically redirect the original page (on your site) to move to whatever page you wanted.

Once the user comes back to your page, whatever content you intended for them could be there.

It's not flawless and requires effort, but options with YouTube are limited when you want to do something on your own website.

If you're trying to make sure only subscribed users see this page, you could look into using YouTube's APIs for checking whether your channel is on their list of subscriptions. See here for more information.

Xevion
  • 570
  • 5
  • 17