A method for determining a location of a target nucleic acid in a biological sample, the method comprising: (a) disposing a biological sample onto an array at a first area, wherein the array comprises a plurality of capture probes, wherein: a capture probe of the plurality of capture probes comprises a spatial barcode and a capture domain, wherein the capture probe is comprised in the first area of the array; and a second area of the array comprises a capture probe of the plurality of capture probes comprising a spatial barcode and a capture domain, wherein the second area is not covered by the biological sample disposed on the array; (b) contacting the second area of the array with a solution comprising terminal deoxynucleotidyl transferase and one or more dideoxynucleotides, such that a dideoxynucleotide is incorporated into the capture domain of the capture probe comprised in the second area of the array; (c) removing residual solution from the second area of the array; (d) permeabilizing the biological sample, such that the capture domain of the capture probe comprised in the first area of the array hybridizes to the target nucleic acid from the biological sample; (e) extending a 3' end of the capture probe of the first area of the array using the target nucleic acid as a template, thereby generating an extended capture probe; and (f) determining (i) a sequence of the spatial barcode of the capture probe comprised in the first area of the array, or a complement thereof, and (ii) all or a portion of a sequence of the target nucleic acid, or a complement thereof, and using the sequences of (i) and (ii) to determine the location of the target nucleic acid in the biological sample. (a) disposing a biological sample onto an array at a first area, wherein the array comprises a plurality of capture probes, wherein: a capture probe of the plurality of capture probes comprises a spatial barcode and a capture domain, wherein the capture probe is comprised in the first area of the array; and a second area of the array comprises a capture probe of the plurality of capture probes comprising a spatial barcode and a capture domain, wherein the second area is not covered by the biological sample disposed on the array; a capture probe of the plurality of capture probes comprises a spatial barcode and a capture domain, wherein the capture probe is comprised in the first area of the array; and a second area of the array comprises a capture probe of the plurality of capture probes comprising a spatial barcode and a capture domain, wherein the second area is not covered by the biological sample disposed on the array; (b) contacting the second area of the array with a solution comprising terminal deoxynucleotidyl transferase and one or more dideoxynucleotides, such that a dideoxynucleotide is incorporated into the capture domain of the capture probe comprised in the second area of the array; (c) removing residual solution from the second area of the array; (d) permeabilizing the biological sample, such that the capture domain of the capture probe comprised in the first area of the array hybridizes to the target nucleic acid from the biological sample; (e) extending a 3' end of the capture probe of the first area of the array using the target nucleic acid as a template, thereby generating an extended capture probe; and (f) determining (i) a sequence of the spatial barcode of the capture probe comprised in the first area of the array, or a complement thereof, and (ii) all or a portion of a sequence of the target nucleic acid, or a complement thereof, and using the sequences of (i) and (ii) to determine the location of the target nucleic acid in the biological sample.