{"id":430,"date":"2005-10-11T13:12:50","date_gmt":"2005-10-11T17:12:50","guid":{"rendered":""},"modified":"2015-09-14T08:07:46","modified_gmt":"2015-09-14T12:07:46","slug":"shorten_a_url_track_a_link","status":"publish","type":"post","link":"http:\/\/pcin.net\/update\/2005\/10\/11\/shorten_a_url_track_a_link\/","title":{"rendered":"Shorten a URL &#8211; Track a Link"},"content":{"rendered":"<div class=\"entry\">\n<p>I recently asked in a couple of issues of the PCIN newsletter if anyone had any suggestions for me. I wanted to shorten links without having to use a service like <a href=\"http:\/\/TinyURL.com\/\">TinyURL.com<\/a> and at the same time, track the popularity of these links (how often they were clicked). I did receive a few responses, with a few being particularly interesting:<\/p>\n<p>Steve Henthorn suggested <a href=\"http:\/\/shorl.com\/\">http:\/\/shorl.com\/<\/a>. At first glance, this seemed perfect. It gives you a username and password for each shortened URL you make which gives you access to stats. But unfortunately, each URL has a unique username and password, which would make it difficult to manage.<\/p>\n<p>Shawn Bremner suggested <a href=\"http:\/\/www.scriptme.com\/SmE_Short_Url.html\">http:\/\/www.scriptme.com\/SmE_Short_Url.html<\/a>. This is a script that is supposed to help you setup a service like <a href=\"http:\/\/TinyURL.com\/\">TinyURL.com<\/a> that you can host (allow others to use your script). This wasn&#8217;t really what I was looking for, but I thought if I could let other people use it, then why not use it myself and disable other users. I tried to install the script, and I just couldn&#8217;t get it to work. <\/p>\n<p>Silvan Kuipers suggested that I use built-in web server features, inparticular use the 404 redirection of Apache. He referred me to <a href=\"http:\/\/www.sitepoint.com\/article\/guide-url-rewriting\">http:\/\/www.sitepoint.com\/article\/guide-url-rewriting<\/a> which has a nice writeup of how to rewrite URLs. This is an area I don&#8217;t have experience in, and seemed difficult so that was as far as I got with it.<\/p>\n<p>So, I headed to <a href=\"http:\/\/www.scriptsearch.com\/\">ScriptSearch.com<\/a> to look a little closer. I scanned the categories, and found one called <a href=\"http:\/\/www.scriptsearch.com\/PHP\/Scripts_and_Programs\/Click_Tracking\/\">Click Tracking<\/a> and one called <a href=\"http:\/\/www.scriptsearch.com\/PHP\/Scripts_and_Programs\/Redirection\/\">Redirection<\/a>. A script called <a href=\"http:\/\/www.cj-design.com\/index.php?id=downloads&amp;page=12\">CJ Linkout<\/a> seemed like what I wanted, but again, I couldn&#8217;t get it to work. The main page of the script is called linkout.php, so I did a search for that and came across a tutorial where someone walked people through how to setup a PHP link tracking redirection tool. Since it runs locally, it has the natural effect of shortening a URL.<\/p>\n<blockquote><p>Outwards Link Counter<br \/>\n<a href=\"http:\/\/www.joe2torials.com\/php\/php_outwards_link_counter.php\">http:\/\/www.joe2torials.com\/php\/php_outwards_link_counter.php<\/a><br \/>\nThis will allow you to create a script that will count the amount of times a certain link has been clicked and display the results on your page.<\/p><\/blockquote>\n<p>I had a few problems setting it up, but I got through it fine, and it works perfectly! I have added some things to the script, setup an admin area, and will start using it live this week. Once there is some stats, I&#8217;ll tweak the reporting pages a little more, and then release the script for everyone to use.<\/p>\n<p>Stay tuned&#8230;<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>I recently asked in a couple of issues of the PCIN newsletter if anyone had any suggestions for me. I wanted to shorten links without having to use a service like TinyURL.com and at the same time, track the popularity of these links (how often they were clicked). I did receive a few responses, with &#8230;<\/p>\n","protected":false},"author":1977,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1],"tags":[],"class_list":{"0":"post-430","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-announcements","7":"anons"},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"http:\/\/pcin.net\/update\/wp-json\/wp\/v2\/posts\/430","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/pcin.net\/update\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/pcin.net\/update\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/pcin.net\/update\/wp-json\/wp\/v2\/users\/1977"}],"replies":[{"embeddable":true,"href":"http:\/\/pcin.net\/update\/wp-json\/wp\/v2\/comments?post=430"}],"version-history":[{"count":0,"href":"http:\/\/pcin.net\/update\/wp-json\/wp\/v2\/posts\/430\/revisions"}],"wp:attachment":[{"href":"http:\/\/pcin.net\/update\/wp-json\/wp\/v2\/media?parent=430"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/pcin.net\/update\/wp-json\/wp\/v2\/categories?post=430"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/pcin.net\/update\/wp-json\/wp\/v2\/tags?post=430"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}