You got her so it is preterite. If you said you were getting her then it would be imperfect. Instead of using tener to say I had, I'd use reciber for I recieved. You would say "Yo la recibí cuando tenía siete años"
La tengo cuando tenía siete años.
The Spanish translation for "I got her when I was seven years old" is "La recibí cuando tenía siete años." The verb "recibí" is in the preterite tense, indicating a completed action, while "tenía" is in the imperfect tense, showing a past state. Together, they demonstrate different aspects of time in the past.
;