Basis of Presentation and Summary of Significant Accounting Policies | Note 2—Basis of Presentation and Summary of Significant Accounting Policies Basis of Presentation and Principles of Consolidation The accompanying consolidated financial statements are prepared in accordance with accounting principles generally accepted in the United States of America (“GAAP”) and include the operations of the Company and its wholly owned subsidiaries. All intercompany transactions have been eliminated in consolidation. The Company has no components of other comprehensive income (loss), and accordingly, the Company’s comprehensive income is the same as its net income for all periods presented. Reverse Stock Split On September 2, 2016, the Company effected a 1-for-3 reverse stock split of its outstanding common stock and a proportional adjustment to the then existing conversion ratios for each series of convertible preferred stock. Accordingly, all share and per share amounts for all periods presented in these consolidated financial statements and notes thereto, have been adjusted retrospectively, where applicable, to reflect this reverse stock split and adjustment of the preferred stock conversion ratios. Use of Estimates The preparation of consolidated financial statements in conformity with GAAP requires management to make estimates and assumptions that affect the reported amounts of assets and liabilities and disclosures of contingent assets and liabilities at the date of the consolidated financial statements and the reported amounts of revenue and expenses during the reporting period. Actual results could differ materially from these estimates. On an on-going basis, management evaluates its estimates, primarily those related to: (1) revenue recognition criteria, including the determination of revenue reporting as net versus gross in the Company’s revenue arrangements, (2) allowances for doubtful accounts, (3) the useful lives of property and equipment and capitalized software development costs, (4) income taxes, (5) assumptions used in the Black-Scholes option pricing model to determine the fair value of stock-based compensation, (6) the recognition and disclosure of contingent liabilities and (7) the assumptions used in valuing acquired assets and assumed liabilities in business combinations Revenue Recognition The Company generates revenue from clients who enter into agreements to use the Company’s platform to purchase advertising inventory, data and other add-on features. The Company charges clients a platform fee, which is a percentage of a client’s purchases through the platform. In addition, the Company invoices clients for the cost of advertising inventory purchased, plus data and any add-on features purchased through the platform less any advertising inventory that clients purchase directly from suppliers through the Company’s platform. The Company maintains agreements with each client and supplier in the form of master service agreements, which set out the terms of the relationship and access to the Company’s platform. The Company recognizes revenue when four basic criteria are met: (1) persuasive evidence of an arrangement exists; (2) delivery has occurred or services have been rendered; (3) the fees are fixed or determinable, and (4) collectability is reasonably assured. In applying the foregoing criteria, the Company recognizes revenue upon the completion of a transaction, that is, when a bid is won, subject to satisfying these criteria. Subsequent to a bid being won through the Company’s platform, the associated fees are generally not subject to adjustment or refund. Historically, any refunds and adjustments have not been material. The Company assesses collectability based on a number of factors, including the creditworthiness of a client or advertiser and related payment history. The Company generally bills clients for the gross amount of advertising inventory, data or other add-on features they purchase through the Company’s platform plus the Company’s platform fees, although some of the Company’s clients have payment relationships directly with advertising inventory suppliers in which case the Company only bills the clients for data, other services and the Company’s platform fees. The Company reports revenue net of amounts it pays suppliers for the cost of advertising inventory, data and add-on features in conformity with Accounting Standards Codification (“ASC”) 605-45, Revenue Recognition -Principal Agent Considerations Based on these and other factors, the Company has determined it is not the principal in the purchase and sale of advertising inventory, data and other add-on features in all of the Company’s arrangements and therefore reports revenue on a net basis for the fees the Company charges clients. The Company’s accounts receivable are recorded at the amount of gross billings to clients, net of allowances (“Gross Billings”), for the amounts it is responsible to collect, and accounts payable are recorded at the net amount payable to suppliers. Accordingly, both accounts receivable and accounts payable appear large in relation to revenue reported on a net basis. Operating Expenses The Company classifies its operating expenses into four categories: Platform Operations. Platform operations expense consists of expenses related to hosting the Company’s platform, which includes “internet traffic” associated with the viewing of available impressions or queries per second (QPS) and providing support to clients. Platform operations expense includes hosting costs, personnel costs, and amortization of acquired technology and capitalized software costs for the development of the Company’s platform, including allocated overhead. Personnel costs included in platform operations include salaries, bonuses, stock-based compensation, and employee benefit costs, and are primarily attributable to personnel who provide the Company’s clients with support using the Company’s platform and the Company’s network operations group, who support the Company’s platform. The Company capitalizes certain costs associated with the development of the Company’s platform and amortizes these costs over their estimated useful lives in platform operations expense. The Company allocates overhead such as information technology infrastructure, rent and occupancy charges based on headcount. Sales and Marketing. Sales and marketing expense consists primarily of personnel costs, including salaries, bonuses, stock-based compensation, employee benefits costs and commission costs for the Company’s sales and marketing personnel. Sales and marketing expense also includes costs for market development programs, advertising, promotional and other marketing activities, and allocated overhead. The Company allocates overhead such as information technology infrastructure, rent and occupancy charges based on headcount. Commissions costs are expensed as incurred. Technology and Development. The Company’s technology and development expenses consist primarily of personnel costs, including salaries, bonuses, stock-based compensation and employee benefits costs, third-party consultant costs associated with the ongoing development and maintenance of the Company’s platform, amortization of capitalized third-party software used in the development of the Company’s platform and allocated overhead. The Company allocates overhead such as information technology infrastructure, rent and occupancy charges based on headcount. Technology and development costs are expensed as incurred, except to the extent that such costs are associated with software development that qualify for capitalization, which are then recorded as capitalized software development costs included in other assets, non-current on the Company’s consolidated balance sheet. The Company amortizes capitalized software development costs relating to the Company’s platform to platform operations expense. General and Administrative. The Company’s general and administrative expenses consist primarily of personnel costs, including salaries, bonuses, stock-based compensation, and employee benefits costs associated with the Company’s executive, finance, legal, human resources, compliance, and other administrative personnel, as well as accounting and legal professional services fees, bad debt expense and allocated overhead. The Company allocates overhead such as information technology infrastructure, rent and occupancy charges based on headcount. Stock-Based Compensation Compensation expense related to stock options, restricted stock awards and units, which are referred to collectively as restricted stock, and awards granted under the Company’s employee stock purchase plan (“ESPP”), is measured and recognized in the consolidated financial statements based on the fair value of the awards granted. The fair value of each option award is estimated on the grant date using the Black-Scholes option-pricing model. The fair value of restricted stock is calculated using the closing market price of the Company’s common stock on the date of grant. Stock-based compensation expense related to stock options and restricted stock is recognized on a straight-line basis over the requisite service periods of the awards, which is generally four years. Stock-based compensation expense for ESPP awards is recognized on a graded-vesting attribution basis over the requisite service period of each award. Stock options granted to non-employees are accounted for at fair value determined by using the Black-Scholes option-pricing model. The Company believes that the fair value of the stock options is more reliably measured than the fair value of the services received. The fair value of the non-employee stock options is re-measured each period until a commitment date is reached, which is generally the vesting date. Determining the fair value of stock options and ESPP awards requires judgment. The Company’s use of the Black-Scholes option pricing model requires the input of subjective assumptions, including the fair value of the underlying common stock for periods prior to the completion of the Company’s IPO, the expected term of the option, the expected volatility of the Company’s common stock, risk-free interest rates, and the expected dividend yield of the Company’s common stock. The assumptions used in the Company’s option-pricing model represent management’s best estimates. These estimates involve inherent uncertainties and the application of management’s judgment. These assumptions and estimates are as follows: Fair Value of Common Stock. For stock options granted subsequent to the Company’s IPO and ESPP awards, the fair value of common stock is based on the closing price of its common stock as reported on the NASDAQ Global Market on the grant date. Prior to the IPO, the board of directors determined the fair value of the common stock at the time of the grant of options by considering a number of objective and subjective factors including the Company’s actual operating and financial performance, market conditions and performance of comparable publicly traded companies, developments and milestones in the Company, the likelihood of achieving a liquidity event and transactions involving the Company’s preferred or common stock, among other factors. The fair value was determined in accordance with applicable elements of the practice aid issued by the American Institute of Certified Public Accountants, . Risk The risk-free interest rate is based on the yields of U.S. Treasury securities with maturities approximating the expected term of the awards. Expected Term. Given insufficient historical data relating to stock option exercises, to determine the expected term, the Company applies the simplified approach, in which the expected term of an award is presumed to be the mid-point between the vesting date and the expiration date of the award. For ESPP awards, the expected term is the time period from the grant date to the respective purchase dates included within each offering period. Volatility. Because the Company has a short trading history for its common stock, the Company determines the price volatility based on the historical volatilities of a publicly traded peer group based on daily price observations over a period equivalent to the expected term of the award, and during the year ended December 31, 2017, the Company began to include a blend of implied volatilities from its traded options. Dividend Yield. The dividend yield assumption is based on the Company’s history and current expectations of dividend payouts. The Company has never declared or paid any cash dividends on its common stock and does not anticipate paying any cash dividends in the foreseeable future, so the Company used an expected dividend yield of zero. During the year ended December 31, 2016, the Company early adopted Accounting Standards Update (“ASU”) No. 2016-09, Compensation—Stock Compensation (Topic 718): Improvements to Employee Share—Based Payment Accounting The Company will continue to use judgment in evaluating the assumptions related to the Company’s stock-based compensation. Future expense amounts for any particular period could be affected by changes in the Company’s assumptions or market conditions. Income Taxes Deferred income tax assets and liabilities are determined based upon the net tax effects of the differences between the Company’s consolidated financial statements carrying amounts and the tax basis of assets and liabilities and are measured using the enacted tax rate expected to apply to taxable income in the years in which the differences are expected to be reversed. A valuation allowance is used to reduce some or all of the deferred tax assets if, based upon the weight of available evidence, it is more likely than not that those deferred tax assets will not be realized. The Company recognizes the tax benefit from an uncertain tax position only if it is more likely than not that the tax position will be sustained on examination by the taxing authorities, based on the technical merits of the position. The tax benefits recognized in the consolidated financial statements from such positions are then measured based on the largest benefit that has a greater than 50% likelihood of being realized. The Company recognizes interest and penalties accrued related to its uncertain tax positions in its income tax provision in the accompanying consolidated statements of operations. On December 22, 2017, "H.R.1," known as the "Tax Cuts and Jobs Act," was signed into law. The primary impact of H.R.1 on the Company’s consolidated results from operations for the year ended December 31, 2017 and consolidated balance sheet as of December 31, 2017 was the revaluation of deferred taxes by $0.6 million resulting from the reduction in the U.S. federal corporate income tax rate from 35% to 21%, effective January 1, 2018. Given cumulative overseas deficits, no liability for foreign earnings and profits has been established. Net Income (Loss) Per Share Attributable to Common Stockholders Basic net income (loss) per share attributable to common stockholders is calculated by dividing the net income (loss) attributable to common stockholders by the weighted-average number of shares of common stock outstanding. The Company applies the two-class method to allocate net income (loss) between common and other participating securities based on their participation rights. Prior to the conversion of preferred stock to common stock concurrent with the IPO and because the holders of the Company’s convertible preferred stock were entitled to participate in dividends, the Company allocated net income to common and preferred stock based on their respective rights to receive dividends, whether or not declared. For 2015, the adjustment to the carrying value of the Series B preferred stock (Note 9) has been recorded as a benefit to net income attributable to common stockholders. For 2016, the excess of the repurchase price of preferred stock over its carrying value (Note 9) has been recorded as a reduction to net income to determine net loss attributable to common stockholders. Diluted net income (loss) per share attributable to common stockholders adjusts the basic net income (loss) per share attributable to common stockholders and the weighted-average number of shares of common stock outstanding for the potentially dilutive impact of stock options, restricted stock, ESPP and warrants, using the treasury-stock method, and convertible preferred stock using the as-if-converted method. Cash and Cash Equivalents The Company considers all short-term highly liquid investments with an original maturity of three months or less to be cash equivalents. Cash equivalents, consisting of money market funds, are carried at fair value. Refer to Note 6—Fair Value Measurements for additional information regarding the fair value of cash equivalents. Accounts Receivable and Allowance for Doubtful Accounts Accounts receivable are recorded at the invoiced amount, are unsecured and do not bear interest. The Company performs ongoing credit evaluations of its clients and certain advertisers when the Company’s agreements with its clients contain sequential liability terms that provide that the client payments are not due to the Company until the client has received payment from its customers who are advertisers. The allowance for doubtful accounts is based on the best estimate of the amount of probable credit losses in existing accounts receivable. The allowance for doubtful accounts is determined based on historical collection experience and the review in each period of the status of the then-outstanding accounts receivable, while taking into consideration current client information, subsequent collection history and other relevant data. The Company reviews the allowance for doubtful accounts on a quarterly basis. Account balances are charged off against the allowance when the Company believes it is probable the receivable will not be recovered. The following table presents changes in the allowance for doubtful accounts (in thousands): Year Ended December 31, 2015 2016 2017 Beginning balance $ 172 $ 686 $ 2,574 Add: bad debt expense 542 1,890 4,289 Less: write-offs, net of recoveries (28 ) (2 ) (4,606 ) Ending balance $ 686 $ 2,574 $ 2,257 Property and Equipment, Net Property and equipment are recorded at historical cost, less accumulated depreciation and amortization. Depreciation is computed using the straight-line method based upon the following estimated useful lives: Years Computer equipment 2 Purchased software 5 Furniture, fixtures and office equipment 5 Leasehold improvements * * Leasehold improvements are amortized on a straight-line basis over the term of the lease, or the useful life of the assets, whichever is shorter. Repair and maintenance costs are charged to expense as incurred, while renewals and improvements are capitalized. When assets are retired or otherwise disposed of, the cost and related accumulated depreciation are removed from the accounts and any resulting gain or loss is reflected in the Company’s operating results. Capitalized Software Development Costs The Company capitalizes certain costs associated with creating and enhancing internally developed software related to the Company’s technology infrastructure. These costs include personnel and related employee benefits expenses for employees who are directly associated with and who devote time to software development projects, and external direct costs of materials and services consumed in developing or obtaining the software. Software development costs that do not qualify for capitalization, as further discussed below, are expensed as incurred and recorded in technology and development expenses in the consolidated statements of operations. Software development activities typically consist of three stages: (1) the planning phase; (2) the application and infrastructure development stage; and (3) the post implementation stage. Costs incurred in the planning and post implementation phases, including costs associated with the post-configuration training and repairs and maintenance of the developed technologies, are expensed as incurred. The Company capitalizes costs associated with software developed when the preliminary project stage is completed, management implicitly or explicitly authorizes and commits to funding the project and it is probable that the project will be completed and perform as intended. Costs incurred in the application and infrastructure development phases, including significant enhancements and upgrades, are capitalized. Capitalization ends once a project is substantially complete and the software is ready for its intended purpose. Software development costs are amortized using a straight-line method over the estimated useful life of two years, commencing when the software is ready for its intended use. The straight-line recognition method approximates the manner in which the expected benefit will be derived. The Company does not transfer ownership of its internally developed software, or lease its software, to third parties. Business Combinations The results of a business acquired in a business combination are included in the Company’s consolidated financial statements from the date of the acquisition. Purchase accounting results in assets and liabilities of an acquired business generally being recorded at their estimated fair values on the acquisition date. Any excess consideration over the fair value of assets acquired and liabilities assumed is recognized as goodwill. Transaction costs associated with business combinations are expensed as incurred and are included in general and administrative expenses in the consolidated statements of operations. The Company performs valuations of assets acquired and liabilities assumed and allocates the purchase price to its respective assets and liabilities. Determining the fair value of assets acquired and liabilities assumed may require management to use significant judgment and estimates, including the selection of valuation methodologies, estimates of future revenue, costs and cash flows, discount rates, and selection of comparable companies. The Company engages the assistance of valuation specialists in concluding on fair value measurements in connection with determining fair values of assets acquired and liabilities assumed in a business combination. In October 2017, the Company paid $3.0 million in cash for certain assets of a data company accounted for as a business combination. These assets primarily consisted of acquired technology and goodwill which are included in other assets, non-current. Operating Leases The Company records rent expense for operating leases, some of which have escalating rent payments, on a straight-line basis over the lease term. The Company begins recognition of rent expense on the date of initial possession, which is generally when the Company enters the leased premises and begins to make improvements in preparation for its intended use. Some of the Company’s lease arrangements provide for concessions by the landlords, including payments for leasehold improvements and rent-free periods. The Company accounts for the difference between the straight-line rent expense and rent paid as deferred rent. Debt Issuance Costs Debt issuance costs related to the term loans have been recorded as a reduction of the carrying amount of the debt and are amortized to interest expense using the effective interest method. Debt financing costs associated with credit facilities have been deferred and recorded in other assets, non-current and are amortized to interest expense on a straight-line basis over the term of the credit facilities. Preferred Stock Warrant Liabilities Prior to the completion of the Company’s IPO, warrants to purchase preferred stock of the Company were accounted for as liabilities at fair value because the underlying shares of convertible preferred stock were contingently redeemable, including in the case of a deemed liquidation, which could have obligated the Company to transfer assets to the preferred stockholders. The preferred stock warrants were recorded at fair value at each balance sheet date and changes in the fair value of the preferred stock warrants during each reporting period were recorded in the Company’s consolidated statements of operations until the earlier of the exercise or expiration of the warrants or the warrants’ conversion to warrants to purchase common stock, at which time any remaining liability was reclassified to additional paid-in capital. Immediately prior to the completion of the Company’s IPO, all of the Company’s then-outstanding convertible preferred stock warrants were remeasured to fair value and automatically converted and reclassified into Class B common stock warrants and all remaining warrants were net exercised. Fair Value of Financial Instruments Fair value is defined as the exchange price that would be received for an asset or paid to transfer a liability (an exit price) in the principal or most advantageous market for the asset or liability in an orderly transaction between market participants on the measurement date. Valuation techniques used to measure fair value must maximize the use of observable inputs and minimize the use of unobservable inputs. Fair value measurements are based on a fair value hierarchy, based on three levels of inputs, of which the first two are considered observable and the last unobservable, which are the following: Level 1—Quoted prices (unadjusted) in active markets for identical assets or liabilities that the Company has the ability to access at the measurement date. Level 2—Inputs other than quoted prices included within Level 1 that are observable for the asset or liability, either directly or indirectly, such as quoted market prices for similar assets and liabilities; quoted prices in markets that are not active; or other inputs that are observable or can be corroborated by observable market data for substantially the full term of the asset or liability. Level 3—Unobservable inputs. Observable inputs are based on market data obtained from independent sources. The carrying amounts of accounts receivable, accounts payable, accrued expenses and other current liabilities approximate fair value due to the short-term nature of these instruments. The carrying value of the line of credit and term loans approximates fair value based on borrowing rates currently available to the Company for financing with similar terms and were determined to be Level 2. The Company’s convertible preferred stock warrants were measured using unobservable inputs that required a high level of judgment to determine fair value, and were thus classified as Level 3. Certain long lived assets including capitalized software development costs are also subject to measurement at fair value on a non-recurring basis if they are deemed to be impaired as a result of an impairment review. To date, no material impairments have been recorded on those assets. Concentration of Risk Financial instruments that potentially subject the Company to concentration of credit risk consist principally of cash and cash equivalents and accounts receivable. The Company maintains its cash and cash equivalents with financial institutions and its cash levels exceed the Federal Deposit Insurance Corporation (FDIC) federally insured limits. For 2015, two clients each accounted for 12% of Gross Billings. For 2016, three clients accounted for 15%, 13% and 11%, respectively, of Gross Billings. For 2017, three clients accounted for 22%, 11% and 10%, respectively, of Gross Billings. As of December 31, 2016, three clients accounted for 27%, 13% and 12%, respectively, of consolidated accounts receivable. As of December 31, 2017, three clients accounted for 33%, 14% and 11%, respectively, of consolidated accounts receivable. As of December 31, 2016, one supplier accounted for 10% of consolidated accounts payable. As of December 31, 2017, one supplier accounted for 12% of consolidated accounts payable. Foreign Currency Transactions and Translation The Company has entities operating in various countries. Each of these entities’ functional currency is the U.S. Dollar. Transactions in foreign currencies are translated into U.S. Dollars at the rates of exchange in effect at the date of the transaction. Net transaction losses were approximately $1.0 million, $1.2 million, and $3.9 million for the years ended December 31, 2015, 2016 and 2017, respectively, and are included in foreign currency exchange loss, net in the accompanying consolidated statements of operations. Commencing in 2015 the Company entered into forward contracts to hedge foreign currency exposures related primarily to the Company’s foreign currency denominated accounts receivable. The Company does not designate the foreign exchange forward contracts as hedges for accounting purposes and changes in the fair value of the foreign exchange forward contracts are recorded in foreign exchange loss, net in the accompanying consolidated statements of operations. As of December 31, 2016 and 2017, the Company had open forward contracts with aggregate notional amounts of $27.1 million and $58.4 million, respectively. The fair value of the open forward contracts was not material. The Company’s forward contracts generally have terms of 30-210 days. Recent Accounting Pronouncements In May 2014, the Financial Accounting Standards Board (“FASB”) issued ASU No. 2014-09, Revenue from Contracts with Customers (Topic 606) In February 2016, the FASB issued ASU No. 2016-02, Leases In June 2016, the FASB issued ASU No. 2016-13, Financial Instruments-Credit Losses (Topic 326): Measurement of Credit Losses on Financial Instruments In August 2016, the FASB issued ASU No. 2016-15, Statement of Cash Flows (Topic 230), Classification of Certain Cash Receipts and Cash Payments In May 2017, the FASB issued ASU No. 2017-09, Compensation—Stock Compensation: Scope of Modification Accounting |