Tweet for Track

If you’re a musician, instead of giving away your music for free why not make one or more tracks available for free if someone tweets about it? This can give you a viral effect as others see the tweet and then they tweet for the track, and so on. If you’re not a musician you can use this for anything like an ebook/PDF, video download, etc. And if you’re not on Twitter, you need to be! Here’s a video tutorial I did (click on the button at the bottom right of the player to view full screen). Note you can uncheck instead of checking ‘Use Twitter for Login’ as mentioned in the video.


Click bottom right button on player for full screen!

In order to make this work you’ll need to download some php code. You can get it at CashMusic. They also have a blog post about setting up Tweet for Track but it’s mostly about setting up the Twitter access. The php code is a series of files with a .php extension as well as two directories. You’ll need to put this code on your server, I suggest in a folder called something like tft so the URL would be http://mysite.com/tft. I use CoreFTP to move the files there.

In order for your website to send a tweet on behalf of the fan, you need to gain access to the Twitter APIs (application programming interface) which are a series of functions that you will need to invoke. Go to the blog post above to find out more. To get this going go to Twitter apps. You’ll need to be logged in to your Twitter account (get one if you don’t have one). For application name it has to be unique so put some like Tweet for Track Band Name, where Band Name is your band name. If you put the code in a directory called tft (my suggestion), the callback URL would be http://mysite.com/tft/callback.php. For application website put http://mysite.com/tft and website http://mysite.com

Default access type = Read and Write, and Use Twitter for Login is No (Note you don’t have to select Yes for ‘Use Twitter for Login’ as mentioned in the video), application type is Browser. Once you submit this you will get a Twitter secret and key. You put these and a few other things in the config.php file which is part of the download. The config.php file has some helpful documentation (see below). Paste the secret and key into the file, add your twitter username without the @ symbol, add your Twitter ID (go to your twitter page and click on the RSS feed link at bottom right and you’ll see your_id.rss. Copy that id (the number before .RSS) into the file. Edit the OAUTH callback field to be http://mysite.com/tft/callback.php (same as what you put in the Twitter form).

The default tweet and required content are important also. The default tweet is what you want the fan to tweet, so a link to your Tweet for Track page along with the name of the song and your twitter name is a good start. Think about what you want others to see to encourage them to download it too! The required content could be your exact default tweet or a subset of the tweet, such as at least the link to your page. You can leave this blank if you don’t want to force the user to tweet anything specific.

You also need to set the download URL to your file and the track name.

This will essentially get you up and running! Of course I ran into a few glitches along with way. One is making sure you are running version PHP5 (not 4). I had to upgrade this on my GoDaddy web host by going into the admin panel. I also had a problem with some of the core PHP libraries which are part of your web host, the php.ini file wasn’t pointing at the right library. My first point of contact when I had issues was CashMusic (info@cashmusic.org). Then I emailed the support desk of my web host.

Another problem I got was something like ‘can’t modify header, already created’. The most common reason for this is a space before or after the opening/closing php tags (

About the Author wkriski

follow me on:

Leave a Comment:

1 comment
Add Your Reply