| Restructuring and Related Costs |
The restructuring charges for the years ended December 31, 2023 and 2022 are recorded as follows (in thousands): | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Year Ended December 31, 2023 | | Year Ended December 31, 2022 | | Employee Terminations | | Facilities Exit Costs | | Asset Impairment Charges | | Total | | Employee Terminations | | | | Asset Impairment Charges | | Total | | Cost of revenue, platform | $ | 1,164 | | | $ | 1 | | | $ | 65,867 | | | $ | 67,032 | | | $ | — | | | | | $ | — | | | $ | — | | | Cost of revenue, devices | 524 | | | 6 | | | 2,793 | | | 3,323 | | | — | | | | | — | | | — | | | Research and development | 31,160 | | | 1,320 | | | 78,011 | | | 110,491 | | | 12,092 | | | | | 7,500 | | | 19,592 | | | Sales and marketing | 29,786 | | | 517 | | | 83,411 | | | 113,714 | | | 10,904 | | | | | — | | | 10,904 | | | General and administrative | 20,531 | | | 1,683 | | | 39,320 | | | 61,534 | | | 7,644 | | | | | — | | | 7,644 | | | Total restructuring charges | $ | 83,165 | | | $ | 3,527 | | | $ | 269,402 | | | $ | 356,094 | | | $ | 30,640 | | | | | $ | 7,500 | | | $ | 38,140 | |
A reconciliation of the beginning and ending balance of employee termination restructuring charges and facility exit costs, which are included in Accrued liabilities in the consolidated balance sheets, is as follows (in thousands): | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Year Ended December 31, 2023 | | Year Ended December 31, 2022 | | Employee Terminations | | Facilities Exit Costs | | Total | | Employee Terminations | | | | Total | | Beginning balance | $ | 22,093 | | | $ | — | | | $ | 22,093 | | | $ | — | | | | | $ | — | | Add: Restructuring charges incurred | 83,165 | | | 3,527 | | | 86,692 | | | 30,640 | | | | | 30,640 | | Less: Payments made | (92,597) | | | (2,329) | | | (94,926) | | | (8,547) | | | | | (8,547) | | | Ending balance | $ | 12,661 | | | $ | 1,198 | | | $ | 13,859 | | | $ | 22,093 | | | | | $ | 22,093 | |
|