python - Pixel Tracking for a django based email -
i wanted know, of emails, have sent have opened email.
here how approach solve problem -
create image file in html template should rendered.
< img src="{{ tracking_url }}" height="1" width="1">
once email opened request made url, have base64 encoded url pattern:
base64_pattern = r'([a-za-z0-9+/]{4})*([a-za-z0-9+/]{2}==|[a-za-z0-9+/]{3}=)'
url(r'^tracking/(?p{})/$'.format(base64_pattern), 'tracking_image_url', name='tracking_image_url'),
that url serve image, , update counter, follows -
transparent_1_pixel_gif = "\x47\x49\x46\x38\x39\x61\x01\x00\x01\x00\x80\x00\x00\xff\xff\xff\x00\x00\x00\x21\xf9\x04\x01\x00\x00\x00\x00\x2c\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02\x44\x01\x00\x3b"
view -
def tracking_image_url(request, mail_64=none): eml = base64.b64decode(mail_64) // update counters in db table email address. return httpresponse(transparent_1_pixel_gif, content_type='image/gif')
i this, can't track opens, missing?
Comments
Post a Comment