  In this paper we study optimal advertising problems that models the
introduction of a new product into the market in the presence of carryover
effects of the advertisement and with memory effects in the level of goodwill.
In particular, we let the dynamics of the product goodwill to depend on the
past, and also on past advertising efforts. We treat the problem by means of
the stochastic Pontryagin maximum principle, that here is considered for a
class of problems where in the state equation either the state or the control
depend on the past. Moreover the control acts on the martingale term and the
space of controls can be chosen to be non-convex. The maximum principle is thus
formulated using a first-order adjoint Backward Stochastic Differential
Equations (BSDEs), which can be explicitly computed due to the specific
characteristics of the model, and a second-order adjoint relation.
