Summary of Significant Accounting Policies | Summary of Significant Accounting Policies (a) Basis of Presentation The accompanying consolidated financial statements have been prepared in accordance with generally accepted accounting principles in the United States of America (“U.S. GAAP”). (b) Principles of Consolidation The consolidated financial statements include the Company and its wholly owned subsidiaries. All significant intercompany balances and transactions have been eliminated. (c) Use of Estimates The preparation of financial statements in conformity with U.S. GAAP requires management to make estimates and assumptions that affect the reported amounts of assets and liabilities, disclosure of contingent assets and liabilities at the date of the financial statements and the reported amounts of revenues and expenses during the reporting period. These estimates are used for, but not limited to, revenue allowances and sales credit reserves; recoverability of long-lived and intangible assets; capitalization and useful life of the Company’s capitalized internal-use software development costs; fair value of acquired intangible assets and goodwill; accruals and contingencies. Estimates are based on historical experience and on various assumptions that the Company believes are reasonable under current circumstances. However, future events are subject to change and best estimates and judgments may require further adjustments, therefore, actual results could differ materially from those estimates. Management periodically evaluates such estimates and they are adjusted prospectively based upon such periodic evaluation. (d) Concentration of Credit Risk Financial instruments that potentially expose the Company to a concentration of credit risk consist primarily of cash, cash equivalents, marketable securities and accounts receivable. The Company maintains cash, cash equivalents and marketable securities with financial institutions that management believes are financially sound and have minimal credit risk exposure although the balances will exceed insured limits. The Company sells its services to a wide variety of customers. If the financial condition or results of operations of any significant customers deteriorate substantially, operating results could be adversely affected. To reduce credit risk, management performs credit evaluations of the financial condition of significant customers. The Company does not require collateral from its credit customers and maintains reserves for estimated credit losses on customer accounts when considered necessary. Actual credit losses may differ from the Company’s estimates. During the years ended December 31, 2019 , 2018 and 2017 , no customer organization accounted for more than 10% of the Company’s total revenue. As of December 31, 2019 and 2018 , no customer organization represented more than 10% of the Company’s gross accounts receivable. (e) Revenue Recognition Revenue is recognized upon transfer of control of promised products or services to customers in an amount that reflects the consideration the Company expects to receive in exchange for those products or services. The Company enters into contracts that can include various combinations of products and services, which are generally capable of being distinct and accounted for as separate performance obligations. Revenue is recognized net of allowances for credits and any taxes collected from customers, which are subsequently remitted to governmental authorities. The Company determines revenue recognition through the following steps: • Identification of the contract, or contracts, with a customer; • Identification of the performance obligations in the contract; • Determination of the transaction price; • Allocation of the transaction price to the performance obligations in the contract; and • Recognition of revenue when, or as, the Company satisfies a performance obligation. Nature of Products and Services The Company's revenue is primarily derived from usage-based fees earned from customers accessing the Company's enterprise cloud computing services. Platform access is considered a monthly series comprising of one performance obligation and usage-based fees are recognized as revenue in the period in which the usage occurs. In the years ended December 31, 2019 , 2018 and 2017 , the revenue from usage-based fees represented 75% , 84% and 83% of total revenue, respectively. Subscription-based fees are derived from certain non-usage-based contracts, such as with the sales of short codes and customer support. Non-usage-based contracts revenue is recognized on a ratable basis over the contractual term which is generally one year or less. In the years ended December 31, 2019 , 2018 and 2017 , the revenue from non-usage-based fees represented 25% , 16% , and 17% of total revenue, respectively. The Company applied the optional exemption of not disclosing the transaction price allocated to the remaining performance obligations for its usage-based contracts and contracts with original duration of one year or less. The majority of the Company's contracts have a duration of one year or less. No significant judgments are required in determining whether products and services are considered distinct performance obligations and should be accounted for separately versus together, or to determine the stand-alone selling price ("SSP"). The Company's arrangements do not contain general rights of return. However, credits may be issued on a case-by-case basis. The contracts do not provide customers with the right to take possession of the software supporting the applications. Amounts that have been invoiced are recorded in accounts receivable and in revenue or deferred revenue depending on whether the revenue recognition criteria have been met. (f) Deferred Revenue and Customer Deposits Deferred revenue is recorded when cash payments are received in advance of future usage on non-cancelable contracts. Customer refundable prepayments are recorded as customer deposits. As of December 31, 2019 and 2018 , the Company recorded $26.4 million and $23.0 million as its deferred revenue and customer deposits, respectively. During the years ended December 31, 2019 and 2018 , the Company recognized $18.7 million and $10.6 million of revenue, respectively, that was included in the deferred revenue and customer deposits balance as of the end of the prior year. (g) Deferred Sales Commissions The Company records an asset for the incremental costs of obtaining a contract with a customer, for example, sales commissions that are earned upon execution of contracts. The Company uses the portfolio of data method to determine the estimated period of benefit of capitalized commissions which is determined to be five years . Amortization expense related to these capitalized costs related to initial contracts, upsells and renewals, is recognized on a straight line basis over the estimated period of benefit of the capitalized commissions. Total net capitalized costs as of December 31, 2019 and 2018 were $30.4 million and $9.4 million , respectively, and are included in prepaid expenses and other current and long‑term assets in the accompanying consolidated balance sheets. Amortization of these assets was $4.5 million and $1.4 million in the years ended December 31, 2019 and 2018 , respectively, and is included in sales and marketing expense in the accompanying consolidated statements of operations. (h) Cost of Revenue Cost of revenue consists primarily of costs of communications services purchased from network service providers. Cost of revenue also includes fees to support the Company's cloud infrastructure, direct costs of personnel, such as salaries and stock-based compensation for the customer care and support services employees, and non-personnel costs, such as amortization of capitalized internal-use software development costs and amortization of acquired intangibles. (i) Research and Development Expense Research and development expenses consist primarily of personnel costs, cloud infrastructure fees for staging and development, outsourced engineering services, amortization of capitalized internal-use software development costs and an allocation of general overhead expenses. The Company capitalizes the portion of its software development costs that meets the criteria for capitalization. (j) Internal-Use Software Development Costs Certain costs of platform and other software applications developed for internal use are capitalized. The Company capitalizes qualifying internal-use software development costs that are incurred during the application development stage. Capitalization of costs begins when two criteria are met: (i) the preliminary project stage is completed and (ii) it is probable that the software will be completed and used for its intended function. Capitalization ceases when the software is substantially complete and ready for its intended use, including the completion of all significant testing. The Company also capitalizes costs related to specific upgrades and enhancements when it is probable the expenditures will result in additional functionality. Costs incurred for maintenance, minor upgrades and enhancements are expensed. Costs related to preliminary project activities and post-implementation operating activities are also expensed as incurred. Capitalized costs of platform and other software applications are included in property and equipment. These costs are amortized over the estimated useful life of the software on a straight-line basis over three years. Management evaluates the useful life of these assets on an annual basis and tests for impairment whenever events or changes in circumstances occur that could impact the recoverability of these assets. The amortization of costs related to the platform applications is included in cost of revenue, while the amortization of costs related to other software applications developed for internal use is included in operating expenses. (k) Advertising Costs Advertising costs are expensed as incurred and were $27.0 million , $10.6 million and $4.9 million in the years ended December 31, 2019 , 2018 , and 2017 , respectively. Advertising costs are included in sales and marketing expenses in the accompanying consolidated statements of operations. (l) Stock-Based Compensation All stock-based compensation to employees, including the purchase rights issued under the Company's 2016 Employee Stock Purchase Plan (the "ESPP"), is measured on the grant date based on the fair value of the awards on the date of grant. This cost is recognized as an expense following straight-line attribution method over the requisite service period. The Company uses the Black-Scholes option pricing model to measure the fair value of its stock options and the purchase rights issued under the ESPP. The fair value of the restricted stock units is determined using the fair value of the Company's Class A common stock on the date of grant and recognized as an expense following straight-line attribution method over the requisite service period. Prior to adoption of ASU 2016-09, the stock-based compensation was recorded net of estimated forfeitures. Compensation expense for stock options granted to nonemployees is calculated using the Black-Scholes option pricing model and is recognized in expense over the service period. The Black-Scholes option pricing model requires the use of complex assumptions, which determine the fair value of stock-based awards. These assumptions include: • Fair value of the common stock. The Company uses the market closing price of its Class A common stock, as reported on the New York Stock Exchange, for the fair value. • Expected term. The expected term represents the period that the stock-based awards are expected to be outstanding. The Company uses the simplified calculation of expected term, as the Company does not have sufficient historical data to use any other method to estimate expected term; • Expected volatility. The expected volatility is derived from an average of the historical volatilities of the common stock of the Company and several other entities with characteristics similar to those of the Company, such as the size and operational and economic similarities to the Company's principal business operations; • Risk -free interest rate. The risk-free interest rate is based on the U.S. Treasury yield curve in effect at the time of grant for zero coupon U.S. Treasury notes with maturities approximately equal to the expected term of the stock-based awards; and • Expected dividend. The expected dividend is assumed to be zero as the Company has never paid dividends and has no current plans to pay any dividends on its common stock. If any of the assumptions used in the Black-Scholes model changes, stock-based compensation for future options may differ materially compared to that associated with previous grants. (m) Income Taxes The Company accounts for income taxes in accordance with authoritative guidance which requires the use of the asset and liability approach. Deferred tax assets and liabilities are recognized for future tax consequences attributable to temporary differences between the financial statement carrying amounts of existing assets and liabilities and their respective tax bases, as well as net operating loss and tax credit carry-forwards. Deferred tax amounts are determined by using the enacted tax rates expected to be in effect when the temporary differences are expected to be recovered or settled. The effect on deferred tax assets and liabilities of a change in tax rates is recognized in income in the period that includes the enactment date. A valuation allowance reduces the deferred tax assets to the amount that is more likely than not to be realized. The Company recognizes the effect of uncertain income tax positions only if those positions are more likely than not of being sustained. Recognized income tax positions are measured at the largest amount that is greater than 50% likely of being realized. Changes in recognition or measurement are reflected in the period in which the change in judgment occurs. The Company records interest and penalties related to uncertain tax positions in the provision for income taxes in the consolidated statements of operations. (n) Foreign Currency Translation The functional currency of the Company's foreign subsidiaries is generally the U.S. dollar. Accordingly, the subsidiaries remeasure monetary assets and liabilities at period-end exchange rates, while non-monetary items are remeasured at historical rates. Revenue and expense accounts are remeasured at the average exchange rate in effect during the year. Remeasurement adjustments are recognized in the consolidated statements of operations as other income or expense in the year of occurrence. Foreign currency transaction gains and losses were insignificant for all periods presented. For those entities where the functional currency is a foreign currency, adjustments resulting from translating the financial statements into U.S. dollars are recorded as a component of accumulated other comprehensive income (loss) in stockholders' equity. Monetary assets and liabilities denominated in a foreign currency are translated into US dollars at the exchange rate on the balance sheet date. Revenue and expenses are translated at the weighted average exchange rates during the period. Equity transactions are translated using historical exchange rates. Foreign currency transaction gains and losses are included in other income (expense), net in the consolidated statements of operations. (o) Comprehensive Income (Loss) Comprehensive income (loss) refers to net income (loss) and other revenue, expenses, gains and losses that, under generally accepted accounting principles, are recorded as an element of stockholders' equity but are excluded from the calculation of net income (loss). (p) Net Loss Per Share Attributable to Common Stockholders The Company calculates its basic and diluted net loss per share attributable to common stockholders in conformity with the two-class method required for companies with participating securities. All series of convertible preferred stock are considered to be participating securities as the holders of the preferred stock are entitled to receive a non-cumulative dividend on a pro rata pari passu basis in the event that a dividend is declared or paid on common stock. Shares of common stock issued upon early exercise of stock options that are subject to repurchase are also considered to be participating securities, because holders of such shares have non-forfeitable dividend rights in the event a dividend is declared or paid on common stock. Under the two-class method, in periods when the Company has net income, net income attributable to common stockholders is determined by allocating undistributed earnings, calculated as net income less current period convertible preferred stock non-cumulative dividends, between common stock and the convertible preferred stock. In computing diluted net income attributable to common stockholders, undistributed earnings are re-allocated to reflect the potential impact of dilutive securities. The Company's basic net loss per share attributable to common stockholders is calculated by dividing the net loss attributable to common stockholders by the weighted-average number of shares of common stock outstanding for the period. The diluted net loss per share attributable to common stockholders is computed by giving effect to all potential dilutive common stock equivalents outstanding for the period. The dilutive effect of these potential common shares is reflected in diluted earnings per share by application of the treasury stock method. For purposes of this calculation, convertible preferred stock, options to purchase common stock, unvested restricted stock units, common stock issued subject to future vesting, any shares of stock committed under the ESPP, any shares of stock held in escrow and any shares of stock reserved for future donations are considered common stock equivalents but have been excluded from the calculation of diluted net loss per share attributable to common stockholders as their effect is antidilutive. Class A and Class B common stock are the only outstanding equity of the Company. The rights of the holders of Class A and Class B common stock are identical, except with respect to voting and conversion. Each share of Class A common stock is entitled to one vote per share and each share of Class B common stock is entitled to 10 votes per share. Shares of Class B common stock may be converted into Class A common stock at any time at the option of the stockholder on a one -for-one basis, and are automatically converted into Class A common stock upon sale or transfer, subject to certain limited exceptions. Shares of Class A common stock are not convertible. (q) Cash and Cash Equivalents The Company considers all highly liquid investments with an original maturity of three months or less when purchased to be cash equivalents. Cash equivalents consist of cash deposited into money market funds and reverse repurchase agreements. All credit and debit card transactions that process as of the last day of each month and settle within the first few days of the subsequent month are also classified as cash and cash equivalents as of the end of the month in which they were processed. (r) Restricted Cash Restricted cash consists of cash deposited into a savings account with a financial institution as collateral for the Company's obligations under certain vendor and facility leases contracts. (s) Accounts Receivable and Allowance for Doubtful Accounts Accounts receivable are recorded net of the allowance for doubtful accounts. The allowance for doubtful accounts is estimated based on the Company's assessment of its ability to collect on customer accounts receivable. The Company regularly reviews the allowance by considering certain factors such as historical experience, credit quality, age of accounts receivable balances and other known conditions that may affect a customer's ability to pay. In cases where the Company is aware of circumstances that may impair a specific customer's ability to meet their financial obligations, a specific allowance is recorded against amounts due from the customer which reduces the net recognized receivable to the amount the Company reasonably believe will be collected. The Company writes-off accounts receivable against the allowance when a determination is made that the balance is uncollectible and collection of the receivable is no longer being actively pursued. The allowance for doubtful accounts was $6.3 million and $4.9 million as of December 31, 2019 and 2018 , respectively. (t) Costs Related to Public Offerings Costs related to the public offerings, which consist of direct incremental legal, printing and accounting fees, are deferred until the offering is completed. Upon completion of the offering, these costs are offset against the offering proceeds within the consolidated statements of stockholders' equity. In the year ended December 31, 2019 , the Company recorded in its consolidated statement of stockholders' equity $1.0 million in total offering costs. (u) Property and Equipment Property and equipment, both owned and under finance leases, is stated at cost less accumulated depreciation and amortization. Depreciation is computed using the straight-line method over the estimated useful life of the related asset. Maintenance and repairs are charged to expenses as incurred. The useful lives of property and equipment are as follows: Capitalized internal-use software development costs 3 years Data center equipment 2 - 4 years Office equipment 3 years Furniture and fixtures 5 years Software 3 years Assets under financing lease 5 years or remaining lease term Leasehold improvements 5 years or remaining lease term (v) Leases In February 2016, the Financial Accounting Standards Board (“FASB”) issued ASU 2016-02, "Leases (Topic 842)" , which was further clarified in July 2018 by ASU 2018‑10, “ Codification Improvements to Topic 842, Leases” , and ASU 2018‑11, “ Leases-Targeted Improvements” . ASU 2018-10 provides narrow amendments to clarify how to apply certain aspects of the new lease standard. ASU 2018-11 addresses implementation issues related to the new lease standard. The standard became effective for the Company on January 1, 2019. Under this standard, lessees are required to recognize in the balance sheet the right-of-use ("ROU") assets and lease liabilities that arise from operating leases. The Company adopted the standard using the optional alternative method on a prospective basis with an effective date as of the beginning of the Company’s fiscal year, January 1, 2019, and applied it to the operating leases that existed on that date. Prior year comparative financial information was not recast under the new standard and continues to be presented under ASC 840. The Company elected to utilize the package of practical expedients available for expired or existing contracts which allowed the Company to carryforward historical assessments of (a) whether contracts are or contain leases, (b) lease classification, and (c) initial direct costs. The Company elected the use of hindsight practical expedient in determining the lease term and assessing the likelihood that lease renewal, termination or purchase option will be exercised. The Company also elected to apply the short-term lease exception for all leases. Under the short-term lease exception, the Company will not recognize ROU assets or lease liabilities for leases that, at the acquisition date, have a remaining lease term of 12 months or less. As a result of implementing this guidance, the Company recognized a $123.5 million net operating ROU asset and a $132.0 million operating lease liability in its consolidated balance sheet as of January 1, 2019. The ROU asset was presented net of deferred rent of $9.0 million as of January 1, 2019, in the accompanying consolidated balance sheet. In addition, on February 1, 2019, the Company acquired through its business combination with SendGrid approximately $33.7 million in operating ROU assets, $32.6 million in operating lease liability, $14.2 million in finance ROU assets and $13.6 million in finance lease liability. The Company measured the lease liability at the present value of the future lease payments as of January 1, 2019. The Company used its incremental borrowing rate to discount the lease payments. The Company derived the discount rate, adjusted for differences in the term and payment patterns, from the information available at the adoption date. The right-of-use asset is valued at the amount of the lease liability adjusted for the remaining December 31, 2018, balance of unamortized lease incentives, prepaid rent and deferred rent. The lease liability is subsequently measured at the present value of unpaid future lease payments as of the reporting date with a corresponding adjustment to the right-of-use asset. Absent a lease modification, the Company will continue to utilize the January 1, 2019, incremental borrowing rate. The Company recognizes operating lease costs on a straight-line basis and presents these costs as operating expenses within the consolidated statements of operations and comprehensive loss. Within the consolidated statements of cash flows the Company presents the lease payments made on the operating leases within the cash flows from operations and principal payments made on the finance leases as part of financing activities. The financial results for the year ended December 31, 2019 , are presented under the new standard, while the comparative periods presented are not adjusted and continue to be reported in accordance with the Company’s historical accounting policy. See Note 5 , “Right-of-use Assets and Lease Liabilities” for further information. (w) Intangible Assets Intangible assets recorded by the Company are costs directly associated with securing legal registration of patents and trademarks, acquiring domain names and the fair value of identifiable intangible assets acquired in business combinations. Intangible assets with determinable economic lives are carried at cost, less accumulated amortization. Amortization is computed over the estimated useful life of each asset on a straight-line basis. The Company determines the useful lives of identifiable intangible assets after considering the specific facts and circumstances related to each intangible asset. Factors the Company considers when determining useful lives include the contractual term of any agreement related to the asset, the historical performance of the asset, the Company's long-term strategy for using the asset, any laws or other local regulations which could impact the useful life of the asset and other economic factors, including competition and specific market conditions. Intangible assets without determinable economic lives are carried at cost, not amortized and reviewed for impairment at least annually. The useful lives of the intangible assets are as follows: Developed technology 3 - 7 years Customer relationships 2 - 8 years Supplier relationships 2 - 5 years Trade names 5 years Patents 20 years Telecommunication licenses Indefinite Trademarks Indefinite Domain names Indefinite (x) Goodwill Goodwill represents the excess of the aggregate purchase price over the fair value of net identifiable assets acquired in a business combination. Goodwill is not amortized and is tested for impairment at least annually or whenever events or changes in circumstances indicate that the carrying value may not be recoverable. The Company has determined that it operates as one reporting unit and has selected November 30 as the date to perform its annual impairment test. In the valuation of goodwill, management must make assumptions regarding estimated future cash flows to be derived from the Company's business. If these estimates or their related assumptions change in the future, the Company may be required to record impairment for these assets. The Company has the option to first perform a qualitative assessment to determine if it is more likely than not that the fair value of a reporting unit is less than its carrying amount. However, the Company may elect to bypass the qualitative assessment and proceed directly to the quantitative impairment tests. The first step of the impairment test involves comparing the fair value of the reporting unit to its net book value, including goodwill. If the net book value exceeds its fair value, the Company would perform the second step of the goodwill impairment test to determine the amount of the impairment loss. In January 2017, the FASB issued ASU 2017‑04, “Simplifying the Test for Goodwill Impairment” , which removes the second step of the goodwill impairment test that required a hypothetical purchase price allocation. A goodwill impairment will now be the amount by which a reporting unit’s carrying value exceeds its fair value. The impairment is limited to the carrying amount of goodwill. This guidance is applied prospectively. The Company early adopted this guidance effective April 1, 2019, which did not have a material impact to its consolidated financial statements. No goodwill impairment charges have been recorded for any period presented. (y) Impairment of Long-Lived Assets The Company evaluates its long-lived assets, including property and equipment and intangible assets, for impairment whenever events or changes in circumstances indicate that the carrying amount of an asset may not be recoverable. Recoverability of assets held and used is measured by a comparison of the carrying amount of an asset or an asset group to estimated undiscounted future net cash flows expected to be generated by the asset or asset group. If such evaluation indicates that the carrying amount of the asset or the asset group is not recoverable, any impairment loss would be equal to the amount the carrying value exceeds the fair value. There was no impairment during the years ended December 31, 2019 , 2018 and 2017 . (z) Business Combinations The Company recognizes identifiable assets acquired and liabilities assumed at their acquisition date fair values. Goodwill is measured as the excess of the consideration transferred over the fair value of assets acquired and liabilities assumed on the acquisition date. While the Company uses its best estimates and assumptions as part of the purchase price allocation process to accurately value assets acquired and liabilities assumed, these estimates are inherently uncertain and subject to refinement. The authoritative guidance allows a measurement period of up to one year from the date of acquisition to make adjustments to the preliminary allocation of the purchase price. As a result, during the measurement period the Company may record adjustments to the fair values of assets acquired and liabilities assumed, with the corresponding offset to goodwill to the extent that it identifies adjustments to the preliminary purchase price allocation. Upon conclusion of the measurement period or final determination of the values of the assets acquired and liabilities assumed, whichever comes first, any subsequent adjustments will be recorded to the consolidated statement of operations. (aa) Segment Information The Company's Chief Executive Officer is the chief operating decision maker, who reviews the Company's financial information presented on a consolidated basis for purposes of allocating resources and evaluating the Company's financial performance. Accordingly, the Company has determined that it operates in a single reporting segment. (ab) Fair Value of Financial Instruments The Company applies fair value accounting for all financial instruments on a recurring basis. The Company's financial instruments, which include cash, cash equivalents, accounts receivable and accounts payable are recorded at their carrying amounts, which approximate their fair values due to their short-term nature. Restricted cash is long-term in nature and consists of cash in a savings account, hence its carrying amount approximates its fair value. Marketable securities consist of U.S. treasury securities, high credit quality corporate debt securities and reverse repurchase agreements. All marketable securities are considered to be available-for-sale and recorded at their estimated fair values. Unrealized gains and losses for available-for-sale securities are recorded in other comprehensive income (loss). In valuing these items, the Company uses inputs and assumptions that market participant |