Create a gist now

Instantly share code, notes, and snippets.

PHP Code to remove Google Analytics cruft from urls
<?php
preg_replace('/(\?|\&)?utm_[a-z]+=[^\&]+/', '', 'http://mashable.com/2010/12/14/android-quick-start-guide/?utm_source=twitterfeed&utm_medium=twitter&utm_campaign=Feed%3A+Mashable+%28Mashable%29');
// Returns http://mashable.com/2010/12/14/android-quick-start-guide/
# 100 urls to test against
# ========================
#
# http://activeinboxhq.com/?utm_medium=Argyle+Social&utm_source=TweetDeck&utm_content=http=//activeinboxhq.com/
# http://battellemedia.com/archives/2010/12/signal_curation_discovery.php?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed:+JohnBattellesSearchblog+(John+Battelle's+Searchblog)
# http://blog.magnation.com/2010/12/06/advent-calendar-giveaways/?utm_source=twitter&utm_medium=social&utm_campaign=Our+Xmas+giveaway+advent+calendar%21
# http://blog.pappastax.com/index.php/2010/12/12/cliff-lee-should-stay-in-texas/?utm_source=twitterfeed&utm_medium=twitter
# http://devzone.zend.com/article/12840-PHP-Manager-1.1-released.?utm_source=feedburner&utm_medium=twitter&utm_campaign=Feed%3A+ZendDeveloperZone+%28Zend+Developer+Zone+-+front+page%29
# http://dooneyandbourkewallet.net/2010/12/12/dooney-bourke-12-days-of-dooney-sale-40-50-off-select-styles/?utm_term=Dooney+and+Bourke+Wallet&utm_source=twitterfeed&utm_medium=twitter
# http://econsultancy.com/us/blog/6924-25-reasons-why-i-ll-leave-your-website-in-10-seconds?utm_source=twitterfeed&utm_medium=twitter
# http://fingercandymedia.com/1407-how-do-you-use-social-media-to-grow-your-business-from-danielstoicatax?utm_source=twitterfeed&utm_medium=twitter
# http://halloweencostumesworldwide.com/1322/armed-and-dangerous-gangster-costumes-for-the-ladies/?utm_source=twitterfeed&utm_medium=twitter
# http://icanhascheezburger.com/2010/11/28/funny-pictures-video-mac-attack-cat/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+ICanHasCheezburger+%28I+CAN+HAS+CHEEZBURGER%3F%29&utm_content=Google+Reader
# http://icanhascheezburger.com/2010/12/12/funny-pictures-made-you-new-file/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+ICanHasCheezburger+%28I+CAN+HAS+CHEEZBURGER%3F%29&utm_content=Google+Reader
# http://idolator.com/5715672/michael-jackson-promo-photos?utm_source=twitterfeed&utm_medium=twitter
# http://irs-hitman.blogspot.com/2010/12/answers-to-your-year-end-charitable.html?utm_source=twitterfeed&utm_medium=twitter&utm_campaign=Feed%3A+IrsHitman+%28IRS+Hitman%29
# http://journal.neilgaiman.com/2010/12/cats-in-sauna-and-boiling-water-tricks.html?utm_source=twitterfeed&utm_medium=twitter
# http://mashable.com/2010/11/19/foursquare-pepsi-safeway/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+Mashable+%28Mashable%29
# http://mashable.com/2010/11/19/pros-cons-php/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+Mashable+%28Mashable%29
# http://mashable.com/2010/11/19/seventeen-facebook-study/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+Mashable+%28Mashable%29
# http://mashable.com/2010/12/10/restaurants-social-media/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+Mashable+%28Mashable%29&utm_content=Twitter
# http://mashable.com/2010/12/12/marketing-web-video/?utm_source=twitterfeed&utm_medium=twitter&utm_campaign=Feed%3A+Mashable+%28Mashable%29
# http://mashable.com/2010/12/12/online-shopping-spend-2010/?utm_source=twitterfeed&utm_medium=twitter&utm_campaign=Feed%3A+Mashable+%28Mashable%29
# http://mashable.com/2010/12/12/social-wellness/?utm_source=twitterfeed&utm_medium=twitter&utm_campaign=Feed%3A+Mashable+%28Mashable%29
# http://mashable.com/2010/12/12/twitter-advanced-search-video/?utm_source=twitterfeed&utm_medium=twitter&utm_campaign=Feed%3A+Mashable+%28Mashable%29
# http://mashable.com/2010/12/14/android-quick-start-guide/?utm_source=twitterfeed&utm_medium=twitter&utm_campaign=Feed%3A+Mashable+%28Mashable%29
# http://mashable.com/2010/12/14/chevy-volt-now-on-sale/?utm_source=twitterfeed&utm_medium=twitter&utm_campaign=Feed%3A+Mashable+%28Mashable%29
# http://mashable.com/2010/12/14/gmail-restore-contacts/?utm_source=twitterfeed&utm_medium=twitter&utm_campaign=Feed%3A+Mashable+%28Mashable%29
# http://mashable.com/2010/12/14/google-voice-search-speech-patterns/?utm_source=twitterfeed&utm_medium=twitter&utm_campaign=Feed%3A+Mashable+%28Mashable%29
# http://mashable.com/2010/12/14/iad-ipad/?utm_source=twitterfeed&utm_medium=twitter&utm_campaign=Feed%3A+Mashable+%28Mashable%29
# http://mashable.com/2010/12/14/jcpenney-sets-up-shop-on-facebook/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+Mashable+%28Mashable%29
# http://mashable.com/2010/12/14/jcpenney-sets-up-shop-on-facebook/?utm_source=twitterfeed&utm_medium=twitter&utm_campaign=Feed%3A+Mashable+%28Mashable%29
# http://mashable.com/2010/12/14/mashable-charlie-white/?utm_source=twitterfeed&utm_medium=twitter&utm_campaign=Feed%3A+Mashable+%28Mashable%29
# http://mashable.com/2010/12/14/mtv-music-meter/?utm_source=twitterfeed&utm_medium=twitter&utm_campaign=Feed%3A+Mashable+%28Mashable%29
# http://mashable.com/2010/12/14/multiple-gmail-accounts-just-got-a-lot-easier-to-manage/?utm_source=twitterfeed&utm_medium=twitter&utm_campaign=Feed%3A+Mashable+%28Mashable%29
# http://mashable.com/2010/12/14/new-facebook-profile-hacks/?utm_source=twitterfeed&utm_medium=twitter&utm_campaign=Feed%3A+Mashable+%28Mashable%29
# http://mashable.com/2010/12/14/real-world-linking-technology/?utm_source=twitterfeed&utm_medium=twitter&utm_campaign=Feed%3A+Mashable+%28Mashable%29
# http://mashable.com/2010/12/14/wishpond-widgets/?utm_source=twitterfeed&utm_medium=twitter&utm_campaign=Feed%3A+Mashable+%28Mashable%29
# http://mumbrella.com.au/latika-bourke-abc-social-media-37518?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+mumbrella+%28mUmBRELLA%29&utm_content=Google+International
# http://net.tutsplus.com/tutorials/javascript-ajax/24-best-practices-for-ajax-implementations/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+nettuts+%28Nettuts%2B%29
# http://news.yahoo.com/s/ap/20101212/ap_en_mo/us_film_afi_top10?utm_source=twitterfeed&utm_medium=twitter
# http://news.yahoo.com/s/ap/20101212/ap_en_mo/us_film_la_critics_awards?utm_source=twitterfeed&utm_medium=twitter
# http://news.yahoo.com/s/ap/20101212/ap_on_en_mo/us_film_afi_top10?utm_source=twitterfeed&utm_medium=twitter
# http://news.yahoo.com/s/ap/20101212/ap_on_en_mo/us_film_la_critics_awards?utm_source=twitterfeed&utm_medium=twitter
# http://news.yahoo.com/s/ap/20101214/ap_en_mo/us_golden_globe_nominations_quotes?utm_source=twitterfeed&utm_medium=twitter
# http://news.yahoo.com/s/ap/20101214/ap_en_mo/us_people_johansson_reynolds?utm_source=twitterfeed&utm_medium=twitter
# http://news.yahoo.com/s/nm/20101214/film_nm/us_goldenglobes_jackiweaver?utm_source=twitterfeed&utm_medium=twitter
# http://news.yahoo.com/s/nm/20101215/film_nm/us_tron?utm_source=twitterfeed&utm_medium=twitter
# http://off-the-record.de/2010/12/13/serviceplan-40-000-euro-for-silliness/?utm_source=twitterfeed&utm_medium=twitter&utm_campaign=Feed%3A+off-the-record%2FVPpB+%28off+the+record+-+Blog+f%C3%BCr+Marketing%2C+Werbung+und+Medien%29
# http://oneforty.com/JanetAronica/timing-your-tweets?utm_source=tw
# http://prezi.com/learn/color-wizard/?utm_source=MadMimi&utm_medium=email&utm_content=Holiday+features%3A+colors+and+fonts%2C+drag+and+drop&utm_campaign=Introducing+Colors%2C+Fonts%2C+and+Snap&utm_term=customize
# http://profalbrecht.wordpress.com/2010/12/12/qe-2-explained/?utm_medium=twitter&utm_source=twitterfeed
# http://pulse2.com/2010/12/14/amit-singhal-top-results-on-google-instant-are-not-paid-for/?utm_source=feedburner&utm_campaign=Feed%3A+pulse2+%28Pulse+2.0+-+Technology+News+and+Reviews%29
# http://pulse2.com/2010/12/14/android-and-ios-market-share-ties-at-38-for-november-report/?utm_source=feedburner&utm_campaign=Feed%3A+pulse2+%28Pulse+2.0+-+Technology+News+and+Reviews%29
# http://pulse2.com/2010/12/14/aza-raskin-steps-down-from-mozilla-to-start-a-company-called-massive-health/?utm_source=feedburner&utm_campaign=Feed%3A+pulse2+%28Pulse+2.0+-+Technology+News+and+Reviews%29
# http://pulse2.com/2010/12/14/best-buy-to-sell-google-nexus-s-on-first-come-first-serve-basis/?utm_source=feedburner&utm_campaign=Feed%3A+pulse2+%28Pulse+2.0+-+Technology+News+and+Reviews%29
# http://pulse2.com/2010/12/14/british-judge-grants-julian-assanges-bail-for-317400-while-sweden-is-appealing-to-keep-him-in-jail/?utm_source=feedburner&utm_campaign=Feed%3A+pulse2+%28Pulse+2.0+-+Technology+News+and+Reviews%29
# http://pulse2.com/2010/12/14/buywithme-ceo-cheryl-rosner-steps-down/?utm_source=feedburner&utm_campaign=Feed%3A+pulse2+%28Pulse+2.0+-+Technology+News+and+Reviews%29
# http://pulse2.com/2010/12/14/google-chromium-testing-location-features/?utm_source=feedburner&utm_campaign=Feed%3A+pulse2+%28Pulse+2.0+-+Technology+News+and+Reviews%29
# http://pulse2.com/2010/12/14/google-voice-now-works-on-the-ipad-and-ipod-touch/?utm_source=feedburner&utm_campaign=Feed%3A+pulse2+%28Pulse+2.0+-+Technology+News+and+Reviews%29
# http://pulse2.com/2010/12/14/google-voice-search-android-app-can-now-associate-your-voice-with-your-google-account/?utm_source=feedburner&utm_campaign=Feed%3A+pulse2+%28Pulse+2.0+-+Technology+News+and+Reviews%29
# http://pulse2.com/2010/12/14/japanese-book-publishers-association-accuses-apple-of-selling-pirated-books-on-app-store/?utm_source=feedburner&utm_campaign=Feed%3A+pulse2+%28Pulse+2.0+-+Technology+News+and+Reviews%29
# http://pulse2.com/2010/12/14/microsoft-rumored-to-be-announcing-new-tablet-devices-at-ces/?utm_source=feedburner&utm_campaign=Feed%3A+pulse2+%28Pulse+2.0+-+Technology+News+and+Reviews%29
# http://pulse2.com/2010/12/14/navteq-buys-speed-trap-tracking-company-trapster/?utm_source=feedburner&utm_campaign=Feed%3A+pulse2+%28Pulse+2.0+-+Technology+News+and+Reviews%29
# http://pulse2.com/2010/12/14/nokia-e7-phone-shipments-delayed-until-next-year/?utm_source=feedburner&utm_campaign=Feed%3A+pulse2+%28Pulse+2.0+-+Technology+News+and+Reviews%29
# http://pulse2.com/2010/12/14/nokia-to-lay-off-about-800-in-finland/?utm_source=feedburner&utm_campaign=Feed%3A+pulse2+%28Pulse+2.0+-+Technology+News+and+Reviews%29
# http://pulse2.com/2010/12/14/tech-companies-working-together-to-go-after-illegal-internet-pharmacies/?utm_source=feedburner&utm_campaign=Feed%3A+pulse2+%28Pulse+2.0+-+Technology+News+and+Reviews%29
# http://pulse2.com/2010/12/14/the-army-wants-soldiers-to-have-an-android-or-iphone/?utm_source=feedburner&utm_campaign=Feed%3A+pulse2+%28Pulse+2.0+-+Technology+News+and+Reviews%29
# http://pulse2.com/2010/12/14/the-top-10-words-used-in-facebook-statuses-for-2010/?utm_source=feedburner&utm_campaign=Feed%3A+pulse2+%28Pulse+2.0+-+Technology+News+and+Reviews%29
# http://pulse2.com/2010/12/14/yahoo-quietly-laying-off-employees-throughout-the-company/?utm_source=feedburner&utm_campaign=Feed%3A+pulse2+%28Pulse+2.0+-+Technology+News+and+Reviews%29
# http://socialmediatoday.com/akarlin/250559/are-brands-socially-disconnected?utm_source=justinflitter
# http://socialmediatoday.com/briansolis/239517/future-advertising-has-been-promoted-new-study?utm_source=feedburner&utm_medium=feed&utm_campaign=Social+Media+Today+%28all+posts%29
# http://socialmediatoday.com/dannybrown/239141/9-points-why-i-m-not-social-media-expert?utm_source=feedburner&utm_medium=feed&utm_campaign=Social+Media+Today+%28all+posts%29
# http://socialmediatoday.com/jgibbard/239855/are-you-thinking-about-social-data-revolution?utm_source=feedburner&utm_medium=feed&utm_campaign=Social+Media+Today+%28all+posts%29
# http://socialmediatoday.com/kenanerden/252192/how-spend-your-social-media-money-2011?utm_source=feedburner&utm_medium=twitter&utm_campaign=Social+Media+Today+%28all+posts%29
# http://socialmediatoday.com/pammoore/239768/social-listening-done-right-stride-gum-case-study?utm_source=feedburner&utm_medium=feed&utm_campaign=Social+Media+Today+%28all+posts%29
# http://socialmediatoday.com/sandeemiller/252240/facebook-can-be-recruiters-best-friend?utm_source=feedburner&utm_medium=twitter&utm_campaign=Social+Media+Today+%28all+posts%29
# http://socialmediatoday.com/steve-olenski/252126/jingle-all-way-7-social-media-tips-your-favorite-holiday-songs?utm_source=feedburner&utm_medium=twitter&utm_campaign=Social+Media+Today+%28all+posts%29
# http://tecdiary.com/blog/it-computers/massiverun-multi-software-installer-v1-3.html?utm_source=feedburner&utm_medium=twitter&utm_campaign=Feed%3A+tecdiary%2Ftecblog+%28tecBlog+by+tecDiary.com%29
# http://techcrunch.com/2010/12/12/cr-48-chrome-notebook-review/?utm_source=twitterfeed&utm_medium=twitter&utm_campaign=Feed%3A+Techcrunch+%28TechCrunch%29
# http://techcrunch.com/2010/12/14/bartz-takes-the-hint-stays-away-from-alibabas-board-for-now/?utm_source=twitterfeed&utm_medium=twitter&utm_campaign=Feed%3A+Techcrunch+%28TechCrunch%29
# http://techcrunch.com/2010/12/14/chrome-os-future/?utm_source=twitterfeed&utm_medium=twitter&utm_campaign=Feed%3A+Techcrunch+%28TechCrunch%29
# http://techcrunch.com/2010/12/14/future-of-streaming-and-the-many-reasons-jeff-bewkes-is-wrong-tctv/?utm_source=twitterfeed&utm_medium=twitter&utm_campaign=Feed%3A+Techcrunch+%28TechCrunch%29
# http://techcrunch.com/2010/12/14/gawker-database/?utm_source=twitterfeed&utm_medium=twitter&utm_campaign=Feed%3A+Techcrunch+%28TechCrunch%29
# http://techcrunch.com/2010/12/14/gmail-delegation/?utm_source=twitterfeed&utm_medium=twitter&utm_campaign=Feed%3A+Techcrunch+%28TechCrunch%29
# http://techcrunch.com/2010/12/14/google-voice-search-can-now-be-trained-to-your-voice/?utm_source=twitterfeed&utm_medium=twitter&utm_campaign=Feed%3A+Techcrunch+%28TechCrunch%29
# http://techcrunch.com/2010/12/14/ipad-iad/?utm_source=twitterfeed&utm_medium=twitter&utm_campaign=Feed%3A+Techcrunch+%28TechCrunch%29
# http://techcrunch.com/2010/12/14/techcrunch-tron-legacy-screenings/?utm_source=twitterfeed&utm_medium=twitter&utm_campaign=Feed%3A+Techcrunch+%28TechCrunch%29
# http://techcrunch.com/2010/12/14/the-dangers-of-externalizing-knowledge/?utm_source=twitterfeed&utm_medium=twitter&utm_campaign=Feed%3A+Techcrunch+%28TechCrunch%29
# http://techcrunch.com/2010/12/14/twitter-growth-stalling/?utm_source=twitterfeed&utm_medium=twitter&utm_campaign=Feed%3A+Techcrunch+%28TechCrunch%29
# http://techcrunch.com/2010/12/14/use-chrome-like-twitter-embedlys-parrotfish-is-your-new-best-friend/?utm_source=twitterfeed&utm_medium=twitter&utm_campaign=Feed%3A+Techcrunch+%28TechCrunch%29
# http://techcrunch.com/2010/12/14/yahoo-confirms-layoffs/?utm_source=twitterfeed&utm_medium=twitter&utm_campaign=Feed%3A+Techcrunch+%28TechCrunch%29
# http://techcrunch.com/2010/12/14/yahoo-employees/?utm_source=twitterfeed&utm_medium=twitter&utm_campaign=Feed%3A+Techcrunch+%28TechCrunch%29
# http://thebloggess.com/?p=9415&utm_medium=Argyle+Social&utm_source=twitter&utm_campaign=sme-share&utm_content=http=//thebloggess.com/?p=9415
# http://thenextweb.com/media/2010/12/13/gawker-hackers-release-file-with-ftp-author-reader-usernamespasswords/?awesm=tnw.to_17Anw&utm_content=twitter-publisher-main&utm_medium=tnw.to-twitter&utm_source=direct-tnw.to
# http://thinkvitamin.com/asides/the-perfect-gift-for-web-designers-and-developers/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+vitaminmasterfeed+%28Think+Vitamin%29
# http://thinkvitamin.com/design/inspiration/star-wars-in-typography/?utm_source=Tweetie&utm_medium=twitter&utm_campaign=Feed%3A+vitaminmasterfeed+%28Think+Vitamin%29
# http://timepasseson.blogspot.com/2010/12/interesting-twitter-experiment-and-what.html?utm_medium=twitter&utm_source=twitterfeed
# http://timepasseson.blogspot.com/2010/12/scams-and-misleading-credit-reports.html?utm_medium=twitter&utm_source=twitterfeed
# http://walyou.com/ham-robot-chef/?utm_source=twitterfeed&utm_medium=twitter&utm_campaign=Feed%3A+TheWalyouBlog+%28The+Walyou+Blog%29
# http://walyou.com/star-trek-door/?utm_source=twitterfeed&utm_medium=twitter&utm_campaign=Feed%3A+TheWalyouBlog+%28The+Walyou+Blog%29
# http://wearesocial.net/blog/2010/12/2010s-trends-twitter/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+wearesocial+%28We+Are+Social%29
# http://wohlnerfinancial.blogspot.com/2010/12/using-investment-losses.html?utm_source=twitterfeed&utm_medium=twitter&utm_campaign=Feed%3A+ChicagoFinancialPlanner+%28Chicago+Financial+Planner%29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment