Unobtrusive onload Google Analytics with jQuery

Uncategorized 2 Comments »

Update: This post was live for about 5 minutes before Michael in the comments brought Google’s official asynchronous solution to my attention. That’s probably a much better way to go. I’ll leave the original post here as google bait though… ;)

I’ve gone ahead and moved the loading and execution of the GA javascript into an external file so as to speed up loading of the page and not delay firing of the onload event.

For every page you want tracked, make sure to include a div (or any element) with the id “ga-pageview-tracking” and include the javascript file shown below.

It’s fairly simple, and I’ve extracted the core of it into a single javascript file. I thought about uploading it to github, but it’s just so tiny.

(function($){
  var GA_ID = "PUT-YOUR-GA-ID-HERE";

  function gaTrackPageview() {
    var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
    var src = gaJsHost + "google-analytics.com/ga.js";

    if($('#ga-pageview-tracking').length) {
      $.getScript(src, function(data, textStatus) {
        var tracker = _gat._getTracker(GA_ID);
        tracker._trackPageview();
      });
    }
  }

  $(document).ready(function() {
    gaTrackPageview();
  });
})(jQuery);

Don’t monetize to cover costs

Business 5 Comments »

I hear over and over from people who are thinking about trying to monetize a fun side project “to cover hosting costs.” I have even succumbed to this line of thinking a few times: “Let’s just throw on AdSense and see what happens..” Whenever you get this idea, you need to resist temptation and push aside your thoughts of casual money. Especially in the case of AdSense, you’ll just end up making your site a little uglier, while probably not even making enough money to cover the time you spent inserting the ad code.

First, let’s examine what it really takes to “cover costs.” Even assuming your side project is a fairly hefty web app that requires its own VPS, you’re still probably looking at no more than $100/mo in hosting fees. Put in context, you’re probably spending less on your project than you’re spending on your cell phone, and that $100 estimate is on the high end. Most side projects can run on the crappy shared hosting you’ve got your blog on, or piggy-backed on a VPS you’re using for something else. In those cases, it’s essentially free.

Still want to cover your hosting costs? Well that’s easy. Just cancel your cable tv, or skip eating at a restaurant twice. Costs covered.

Second and most important, remember that it’s perfectly acceptable to have hobbies that cost you money and provide nothing in return except enjoyment. My favorite comparison here is rec-league softball. I played for several seasons and I loved it. I had to spend about $100 to get all my equipment, and then each season had a registration fee of about $60. It never occurred to me to monetize my softball game in order to cover those costs. Maybe I could have sold ad space on my jersey, or some crap like that, but it probably would have been a huge waste of time. Why should a web hobby be any different?

The only reason to monetize a web project is if you intend to make serious money. There’s no guarantee that you’ll succeed, but a sizable payout (defined however you want) should be the goal. Until you’re ready to look in the mirror and say, “Let’s make some money!” then don’t worry about it. Just take pleasure in your hobby and the knowledge that you’re making the web a better place.

Update A lot of people on Hacker News disagreed with my “suck it up” mentality, and a few had some really good ideas on how to cover costs, without resorting to AdSense.

From jeff18:

  • Ask a buddy to let you put the site on one of their under utilized servers. Sharing a VPS amongst a group of friends is a great way to spread costs.
  • Ask a company to sponsor you.
  • Ask for donations from the community. This is probably one of the best ways to “cover costs” if that’s your true goal. Just run a fundraiser once a year or so.

Regarding Jeff’s company sponsorship idea, I can personally say that’s a good one. I (as Obsidian Portal) offered to host the RPG Bloggers Network for free, in exchange for a “hosted by” link and a note to contact me for an introduction in the email sent to new members. They ultimately turned down the offer, but it would have been a killer deal for me.

From uggedal: Collect referral fees. Uggedal supports wasitup with referral bonuses to Linode. Referrals to your hosting company makes perfect sense for a hacker project, but you may have to get more creative if your subject domain isn’t hacker-centric.

Rackspace Email and sSMTP on a Slicehost server

Ruby on Rails, Site Admin No Comments »

This is just a brain-dump of everything I’ve learned while stumbling my way through setting up sSMTP with Rackspace email. For the record, I created a single email account on Rackspace and set up sSMTP on my server to authenticate with the credentials for this account.

From line override – @mydomain

When I enabled FromLineOverride, my emails stopped sending. I thought it was spam filters gobbling them up, but it turned out that Rackspace was refusing to send. Looking in the mail log (/var/log/mail.log), I saw this over and over:

RCPT TO: (550 5.1.0 : Sender address rejected: User unknown in relay recipient table)

I fought with this for several hours until the Rackspace help chat technician was able to guide me to a solution. Apparently, if you’re sending emails with a From address from your domain then the From address has to match up to either a real Rackspace email account, or it has to match one of your aliases. Forget about sending from no-reply@mydomain.com unless that’s a real box.

From line override – @mydomain – with catch-all set

Creating a catch-all email seems to change this behavior. Once your catch-all is set, you can send from whatever address you want on your domain. I guess it makes sense, as now any address is a valid return address on your domain.

From line override – @otherdomain

Strangely enough, if you use a From address with a different domain, it all works fine. So, you can pretend all day long to send emails from other domains and Rackspace doesn’t care. But, send an email from a pretend address on your own domain and you’re screwed. Weird.

cron jobs and From line

You have very little control over the From line created by your cron jobs. AFAIK, they’ll always use only the username of the user executing the job. If the output is emailed out then sSMTP will append your domain to this username. Rackspace will reject the email if there’s no account or alias with that name. This means you may need to set up an alias for deploy or whatever user you use for executing your app’s cron jobs, assuming you want to receive the emailed output.

ssmtp.conf is case sensitive

Maybe I’m wrong here, but I swear that ssmtp.conf is case sensitive for YES/NO, even though I’ve seen them used interchangeably in different tutorials. In my case, FromLineOverride only made a difference when I used “no” and not “NO”. Every other YES/NO option seemed to ignore the case. Maybe I’m just crazy.

SPF record

Don’t forget to set up your SPF record! Assuming you’re just going to send email through Rackspace, the following record should work:

v=spf1 include:emailsrvr.com -all

Note: That’s a hard-fail, since I’m a hardass ;)

DKIM

Nope, not as far as I know. How hard would it be for providers to add this service? Maybe impossible if it would involve them signing emails with your key or something like that.

Well, that’s it. If I’m wrong, or there’s anything I should add, please let me know in the comments.

Update on DoLeaf progress

Business No Comments »

I actually got a request on Hacker News to write up a “where are we now” on DoLeaf. Since I’m an egotistical bastard who loves talking about his projects, here I am with an update. But, since I’m also an entrepreneur, I’m going to try and use you, the reader, to my benefit!

Timeline

Before launching into the particulars, let me lay out the timeline. DoLeaf as an idea was born around September of 2008. The business was officially founded and coding started around January 2009, and we officially launched into our beta in July of 2009. So, we’re a little over a year into it now. So, for all you get-rich-quickies, stop reading now, since this is a story of the long-view, not a 6-month hockey stick fairy tale.

Recruiting Sellers

We knew the hardest part initially would be getting sellers to sign up. Fortunately for us, it seems that we were right to assume that there was a need unserved out there.

As of now, we have 11 active stores, and a couple more that are finalizing their preparations before going live. Overall, the response has been very positive from the nursery community. They see the value in what we’re offering, and it’s definitely a nicer alternative for them than paying some shady consultant $1000s to set up a rickety online shopping cart.

We also hired a marketing consultant to help us reach out to the sellers via magazines and such. Overall, we’ve been very pleased with her work and it allowed us to recruit our first crop of sellers. Believe me, your first user is 1000x harder to recruit than your 100th. It’s hard to convince someone to be the first to jump.

Where are these orders coming from?

We’ve done essentially no marketing or advertising to buyers. Instead, we’ve been focusing on recruiting sellers in order to make sure we have a robust catalog of listings. We knew we had a chicken(sellers) v egg(buyers) problem, so we decided to try and find some chickens.

Even still, we’ve had a fairly brisk pace of orders. I’m not going to list actual numbers, but suffice it to say that we expected pretty much 0 orders (aside from friends’ whose arms we twisted) without advertising. The brisk (and increasing) pace was pretty baffling until we looked into how the customers were arriving.

SEO is still King

We forgot to factor in the power of SEO + targeted searching. Initially, we had hoped to place high for search phrases like “garden marketplace” or “buy plants online“.

Imagine our surprise to find out that we placed high for things like “siam ruby banana” or “peachy sunrise daylily“. Moreover, the conversion rates for these terms is crazy high. Of course anyone familiar with search engine marketing can see why. People searching for very specific things have money in hand ready to buy. People wanting a Siam Ruby Banana can have one ordered in a couple clicks.

We also (on the advice of a savvy seller) decided to submit our listings to Google Product Search. It took an hour or so to whip up an Atom feed that they crawl. Sales started rolling in the very next day. Every day I love Google a little bit more.

Forget Social Media

Initially we had planned to try and be all kinds of social savvy. Forget it. Now that we’ve seen the power of SEO, we’re going to walk that road. Antiquated? Old-school? Maybe so, but I’m convinced that DoLeaf can corner the market on a good chunk of plant botanical names. I’m confident that we can be on Google page 1 when you search on a botanical or common name of a plant we carry. I’m much less confident that I can get people on Twitter to fawn all over us and fan us on Facebook. That’s fine with me, though. We’re looking for sales, not fans.

Overwhelming Enthusiasm

For better or worse, we’ve got one star seller who is pushing DoLeaf to the max. We expected most sellers to list a handful of plants and take a wait-and-see approach. For the most part, that’s what they’ve done.

…Except for one. One seller found DoLeaf and turned the dial up to 11. He’s listed over 300 plants, and accounts for probably 75% of our total listings. Not surprisingly, he also accounts for the lion’s share of our sales. It’s a little scary, but exhilarating at the same time. He sees the same potential that we do, and really believes in what we’re doing. I just hope that we can make it worth the time he’s invested. As always, I’m more worried about disappointing our users than about making a profit. I’m a firm believer that if our sellers are successful and happy, then it’s impossible for DoLeaf to fail.

Buyers: The Next Frontier

Now that we’ve got a decent selection of plants, we’re ready to turn our focus toward enticing buyers. We’re going to..wait for it…try and reach people offline. This is a bit of a stretch for us, but we’ve been reminded over and over that the gardening community still has a very strong physical presence. So, we’re talking to print magazine editors, going to local gardening meetings, and generally trying to get more involved with the real-life of gardening. It can be difficult, but at the very least, I’m learning more about plants, which is a subject I truly enjoy. You can see me outside at all hours of the day inspecting my tulip bulbs and climbing roses.

I’m not sure how successful we’ll be in our buyer outreach, but the fact that our SEO efforts are proceeding so well gives me confidence that even if we fail as advertisers, we’ll still do OK on sales.

YC 2k10?

Since most people reading this will be coming from Hacker News, I’ll go ahead and say that we’re planning on applying yet again for YCombinator. However, I’m going to be smart about it this time, unlike before. I’m going to dust off our previous application, edit some dates, and resubmit. Then I’ll forget about it. We’ll probably do the same with TechStars.

Why so little effort? Because at this point I’m confident that we don’t need them. We could definitely use the help, but we’ve crossed the barrier of proving it could work. Now all we have to do is show that we have the skill and perseverance to be the ones to actually make it work.

Wanna Help?

Since our SEO efforts are proving so fruitful, I’m going to ask for your help. If you have a blog, please write a short post about DoLeaf. Pick out some crazy plants (here are a few specimens) and link to them from a blog post. That’s it! We’ll be eternally grateful, and you’ll be helping a small startup, as well as the small, family-owned businesses we serve. It counts as your good deed for the day.

CloudFront SSL with Rails and attachment_fu

Plugins, Ruby on Rails No Comments »

One of the most irritating things about CloudFront is the lack of SSL support. It’s incredibly frustrating to install an SSL certificate, get all your routing set up, then watch the browser freak out because one teeny-tiny image comes through without encryption. A major pain in the ass.

Anyways, it’s possible to sidestep the issue by requesting the image directly from S3 instead of CloudFront. You are no longer leveraging the CDN, but in my case I’d rather have the page load slightly slower than have the browser complain about security flaws.

CloudFront Helper

I wrote the following helper to make it all easy:

module CloudfrontHelper
  # Will return a URL to an S3/Cloudfront image. If the current request is HTTPS, then it will return
  # an HTTPS URL (ie. S3) and if it is HTTP then it will return a Cloudfront URL.
  def cf_img_url(s3_image, *params)
    if request.ssl?
      s3_image.s3_url(*params)
    else
      s3_image.public_filename(*params)
    end
  end
end

SSL Config in amazon_s3.yml

The final step is to turn on SSL support for attachment_fu

production:
  bucket_name: my-bucket
  access_key_id: asdf
  secret_access_key: xxxx
  distribution_domain: [my-cloud-distribution]
  use_ssl: true

Example Usage

Now, anywhere you need to display an image that’s hosted on S3/CloudFront, just use the cf_image_url helper and it will automatically route to either the S3/https version or the CloudFront/http one depending on the protocol for the request. Simple!

< %= image_tag(cf_img_url(@user.profile_pic)) %>

Web Entrepreneurship Presentation at KC Ruby

Uncategorized 2 Comments »

I had the privilege of speaking at the Kansas City Ruby User Group the night on the topic of Web Entrepreneurship. This is the second presentation along this subject. The first was an in-depth walk through how Jon Crawford went from a full time consultant to building his idea, finding his team, and putting his full effort into Storenvy. You can view his post regarding his presentation here: http://joncrawford.com/entries/web-entrepreneurship-presentation-at-kcrug.

Jon had many great points throughout his presentation and was to use those building blocks to discuss how follow entrepreneurs could build their online startup while keeping there day job. As I mention in the presentation, I love the experience that consulting provides, and given my already limited sleep schedule I find building my own startup during nights and weekends satisfies my hunger while also allowing me to keep the lights on. I definitely wanted to layout all the advantages, disadvantages, and discipline that a 60+ hour work week requires.

Web Entrepreneurship – While Keeping Your Day Job – Part 1


Web Entrepreneurship -- Ryan Felton -- Part 1 from Steven Chau on Vimeo.

Web Entrepreneurship – While Keeping Your Day Job – Part 2


Web Entrepreneurship -- Ryan Felton -- Part 2 from Steven Chau on Vimeo.

Slides

Update

Seth Godin gave a presentation today for Jelly Groups saying your going to burn out quickly. That freelancers are different then entrepreneurs. He mentioned that your goal should be to work like crazy freelancing to build up enough to live off when you quit your freelancing and switch to an entrepreneur. The major aspect issue with this (as mentioned in the presentation) is healthcare. Also, I recommend if you are going to take this approach prepare yourself to live as an full-time entrepreneur for 13 months as that tends to be the make or break period.

Rails, Textile, and javascript WYSIWYG roundup – part 2

Uncategorized 1 Comment »

In part 1, I examined a few of the editors and tried to give some plusses/minuses of each one. At the end, I mentioned markItUp! as a possible editor, but couldn’t make a recommendation due to lack of experience with it.

Now that I’ve used it, I can say definitively that it’s amazing! To be fair, it’s not a true “wysiwyg” editor and is instead a set of buttons and aides for editing some sort of markup language. However, if you are only looking for something that will make editing easier on your users, markItUp is perfect.

Skip the others and go straight to markItUp. You’ll be glad you did.

Ignoring Google Wave

Business, Ruby on Rails No Comments »

There’s been a lot of buzz surrounding Google Wave recently, and I’m proud to admit that I still have really no idea what it is. I’ve decided to ignore it and let the rest of the community digest it and tell me whether it’s the real deal or just a flash in the pan. Why? Because I’m trying to be an entrepreneur, and Wave is not going to make me any money.

I’ll admit, it’s tough not to get caught up in the excitement. Here’s a snippet from an email I received recently regarding a meetup to discuss Wave (original emphasis left intact).

I’m going to make this short and sweet. We have a meeting this Thursday July 16th. The next paragraph explains why, if you are a true web enterpreneur, you shouldn’t miss the event.

If you didn’t cash out during the DotCom boom and haven’t found success with the Web 2.0 surge including the Facebook and iPhone app bonanzas yet are still looking for opportunity then you need to seriously think about Google Wave. To learn how Google Wave could be the “3rd wave” of Internet Innovation behind “DotCom” and “Web 2.0″ come to our AWE meeting this Thursday July 16 as we’ll present Google Wave and have an open discussion on the opportunities that it presents.

Wow. When I read that, my first thought was: “I had better be there. I don’t want to miss the boat yet again.” I never made a Facebook app (except for work), and I likewise didn’t make a million in the App Store. I’m still working on making some Web 2.0 money, but it sure hasn’t resembled anything like a hockey stick. So, getting a foot in the door early on “the next big thing” holds somewhat of an allure for me, as I’m sure it does for any hacker.

However, I’m trying hard to keep myself head-down on DoLeaf and Obsidian Portal and ignore all non-core technologies. I don’t need a new toy, I need new customers. Plain and simple. Jon Crawford of Storenvy says it best: Stop learning new stuff! (13:40 minutes in) I think that’s the difference between a hacker and an entrepreneur. At some point, the entrepreneur has to do the 90% of the app that’s not cool and not fun. Hackers can put down their current project and pick up a new toy whenever they feel like it. It’s a good life, but I doubt it leads to financial success.

So, if you’re a hacker, please play with Wave, make something cool with it, then push it in my face so I can’t ignore it. Meanwhile, if you’re an entrepreneur who already has a project, I suggest you do what I’m doing: Get back to work.

Atlanta Startup Ecosystem 2.0 – Lifestyle Entrepreneurs Not Invited?

Business 11 Comments »

I noticed the other day that some of the organizers in The Scene (ie. Atlanta startup culture) are hosting a meetup to talk about the next steps needed by the startup community. In big bold letters are instructions detailing that possible attendees should evaluate themselves according to these criteria:

Who SHOULD Attend

If one of the following phrases describes you then you SHOULD attend this event:

  • Entrepreneurs who “Swing for the Fences”
  • Angel Investors, Venture Capitalists and Institutional Investors
  • Service Providers that service the Startup Community
  • Other Supporters of the Startup Community Ecosystem

Who Should NOT Attend

If one of more of these labels describes you more than one of the previous labels then you SHOULD NOT attend this event:

  • Lifestyle Entrepreneurs (emphasis mine)
  • Small Businesses using the Web for marketing
  • People who prefer the security of employment
  • Developers, Designers, Freelancers
  • Internet and Network Marketers
  • Interactive Agencies

No Lifestyle Entrepreneurs?

As a recovering wannabe “Swing For the Fencer”, I’m dismayed at the specific exclusion of lifestyle entrepreneurs. When did running a successful-but-not-Google-size business become a failure? Wouldn’t The Scene be much better off with dozens or hundreds of successful small businesses as opposed to a handful of mega hits and hundreds of failures? Let’s keep this list growing at a healthy clip, while keeping this one as small as possible. I know people love to throw around fail-fast as a mantra, but I prefer to win-slow. Successful small business that pays the bills? Put me down for one, please.

In my own experience, I was only able to truly get a shot at success when I stopped swinging for the fences. When I stopped dreaming about VC money, IPOs, and a Google buyout, I set about to actually building a revenue model for my projects. In addition, I stopped pursuing ventures that had no underlying business model besides the get-big-get-bought prayer. All of a sudden, I started making money. It’s not a lot, but it’s growing. I bunted my way to first base, and now I’m trying to figure out how to steal second.

Tweet Less, Blog More

Uncategorized 6 Comments »

Goodbye Twitter

After playing with Twitter for a couple months now, I’ve decided that it’s really not all that useful as a way to express my thoughts and feelings. I spend a lot of time trying to come up with witty zingers, but nothing I say ever generates any real commentary. My gut feeling is that very few people actually read what I tweet, which is a little humbling and disappointing. More and more it feels like I’m screaming into an ever-more-crowded room filled with people screaming. We’re all trying to out-scoop or out-zing each other, in 140 characters or less.

Conversely, this blog has always felt like a calm, collected place where I can express my thoughts and interact with a small group of interested readers. The majority of my posts generate little traffic and zero comments, but I know they’re read by my close friends. However, I’ve had several blog posts that have generated a great deal of commentary. I provided some thoughtful analysis, and people felt compelled to comment (often after some baiting on Hacker News or Twitter). The readers learned from my experiences, and they added their thoughts. The postings remain visible and can be easily found via Google. Finally, many of the posts still generate traffic and comments even months or years after the original posting. Try getting response to a tweet even 6 hours after the original posting.

For these reasons, I’ve decided that I’m going to reduce my time spent on Twitter and instead try to collect my thoughts into real, thoughtful writing. If I feel the itch to go tweet about something shiny, I’m going to ask myself if it’s something that I really think people care about, or am I just acting under the same impulse as the people who write “First!” in comments on Youtube. I’ll still succumb every now and then, but I think I’m over Twitter.

Update: I’ve also found that going on a massive un-follow campaign can vastly improve your Twitter experience. Clear out all the cruft: celebrities, brands, logos, and especially the chatty egoists who never shut up. Once you pare it down to just friends and a handful of personalities, Twitter is much more enjoyable.

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in