A consumer typically visits an online store a few times before making a purchase decision, and on each visit spends some time browsing the store. The durations of these visits vary not only across consumers but also for a given consumer across multiple visits. We argue that the amount of time that a consumer spends on the first visit to a website depends on how she is drawn to the website. We find that the duration of the first visit is influenced by the advertising toolbanner ad or search engineused to attract consumers to the website. The durations of subsequent visits are influenced by the durations of earlier visits. The search durations are also influenced by the visit day of the week and time of day. In this paper, we develop a multiple-spell competing risk model to capture the underlying stochastic process, chief elements of which are two interrelated processes: a duration process and a transition process. The multistate, multiple-spell model allows us to identify a window of opportunity, within which the purchase probability is higher than the exit probability. Online salespersons should target site visitors during this window of opportunity. The model, which is calibrated on clickstream data obtained from a major online vendor, can also be used to determine the bid price strategy for search engine ads.