Mobile bookings were up 1% quarter-over-quarter, but down 12% year-over-year, as new mobile game launches did not generate enough bookings to offset aging live games, and in particular Draw Something was a difficult year-over-year comparable. Mobile bookings represented 19% of bookings a year ago and 27% of bookings in the second quarter of this year. Facebook-related bookings were 68% of total.
Moving on to revenues; GAAP revenue in the second quarter was $231 million, down 31% year-over-year, and from a geographic perspective 60% of revenues came from the U.S. Our top revenue-generating games for the second quarter were Zynga Poker, FarmVille, and FarmVille 2, which comprised 20%, 16%, and 15% of our online game revenue, respectively. No other game contributed more than 10% to the quarter.
Now let me walk you through operating expenses. Cash operating expenses were down $22 million quarter-over-quarter, primarily driven by lower labor, outside services, and technology spend. In addition to the progress we've made, we remain focused on cost controls and continue to see incremental opportunities to drive further savings in 2013.
Note that the amounts I am about to mention, excludes stock-based expense of $26 million and restructuring costs of $25 million.
In Q2, cost of revenue was $62 million, down 33% year-over-year, driven primarily by lower tech, amortization from acquisitions, and outside services spend. R&D expense in Q2 was $89 million, down 16% year-over-year, largely due to lower labor costs. The results were bound to have a better than expected adjusted EBITDA of $8 million in Q2 and this resulted in a 4% adjusted EBITDA to bookings margin.
In Q2, we recorded a non-GAAP tax benefit of $17 million. The benefit was driven by non-recurring change in our estimated jurisdictional mix of earnings. This resulted in a non-GAAP net loss of $6 million or $0.01 loss per share. Our non-GAAP diluted weighted average share count was 794 million shares in Q2.
Turning to our balance sheet, we ended Q2 in a strong position with cash and marketable securities of approximately $1.5 billion, down $138 million from Q1. In Q2, we made a treasury decision to retire all $100 million of our outstanding debt as the interest expense was higher than what our cash was earning.
Additionally, we used $19 million in cash for restructuring and acquired Spooky Cool Labs, which was a net use of cash, equal to $18 million. With regards to our authorized share repurchase plan, no shares were repurchased in the quarter; however, we continue to evaluate the best uses of our cash to fund the growth and the long-term enterprise value of our company.
Looking at cash flow, cash flow from operations was negative $1 million. CapEx was $1 million in Q2 and $6 million for the first six months of 2013, which compares to $78 million for the first six months of 2012, excluding the purchase of our building. Overall, we ended the quarter with negative free cash flow of $14 million.
Headcount was 2,360 at the end of Q2, down 628 quarter-over-quarter, primarily due to the previously announced reduction in force.