title: Pixel Tracking for a django based email
body: <p>I wanted to know, which of the emails, that I have sent to have opened the email. </p>
  
  <p>Here is how I approach to solve the problem - </p>
  
  <ol>
  <li><p>Create an image file in the html template that should be rendered. </p>
  
  <p>&lt; img src="{{ tracking_url }}" height="1" width="1"></p></li>
  <li><p>Once an email is opened a request will be made to a url, which will have base64 encoded url pattern:</p>
  
  <p>base64_pattern = r'([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)'</p>
  
  <p>url(r'^tracking/(?P{})/$'.format(base64_pattern), 'tracking_image_url', name='tracking_image_url'),</p></li>
  <li><p>That URL will serve an image, and update the counter, as follows - </p>
  
  <p>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"</p></li>
  </ol>
  
  <p>view - </p>
  
  <pre><code>def tracking_image_url(request, mail_64=None):
      eml = base64.b64decode(mail_64)
      // Update the counters in the DB table for the email address. 
      return HttpResponse(TRANSPARENT_1_PIXEL_GIF, content_type='image/gif')
  </code></pre>
  
  <p>I do all this, but can't track the opens, what am I missing?</p>