Freebies

Freebies: Tweet To Enter jQuery Plugin

Tweet To Enter

The freebie today is a jquery plugin which can be used to get access to bits of content but only if a tweet is sent first.

Demo

Introduction

There are many websites out there that have premium content locked away and the only way to get to it is by paying a monthly fee to the publisher.

What if you have premium content but you don't want people to pay for it but you don't want to give it away for free?

Using the Tweet To Enter jQuery plugin you can only allow people access to this content if they tweet about it. Making the content free for the consumer and also gives you the publisher free organic content promotion.

This product is perfect if you have a ebook or downloadable content and only allows people to download this content if they tweet about it.

How To Install

To install the plugin on your website is very simple just move the plugin file into your website folder and include it in your HTML.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js"></script>
<script src=script/jquery.tweetToEnter.js></script>

Add a link on your page with a id or class attribute.

<a href="#" class="enter_button">Tweet To Enter<a>

Apply the plugin to the link.

<script>
$(document).ready(function(){
	$('.enter_button').tweetToEnter({
		button_text: "Click To Download Tweet To Enter Plugin",
		text: "I've just downloaded the Tweet To Enter Plugin",
		button_url:  "http://www.paulund.co.uk/playground/demo/tweet_to_enter/download.zip"
	});
});
</script>

Now load the page, when you click on the tweet to enter link the twitter box will appear with the message.

I've just downloaded the tweet to enter jQuery plugin from Paulund http://www.paulund.co.uk.

When this message is tweeted the window will close and the link will now change to be directed to the premium content.

Parameters

Below is a list of parameters you can use with the Tweet To Enter plugin.

  • Unlock_url - This is the url that will link will change to after the tweet has been sent.
  • Text - This is the default message to be tweeted.
  • Button_Class - Is the class used to identify which button to change make sure this is unique.
  • Button_Text - This is the text that will replace the button text after the tweet is sent.
  • Related - Twitter user account that is related to the tweet sent.
  • Via - Twitter account that is added to the end of the tweet.

Demo

Back to top

Learn how to code with Treehouse

  • Learn projects with access to 1000+ videos
  • Practice live with our Code Challenge Engine
  • Get help in our members-only forums

Start with a 7 day free trial