Using GA mobile tracking for email open rates

363 views Asked by At

I've looked at several resources on here about this topic but can't quite find the answer that fits.

I'm wanting to use the GA mobile tracking to grab open rates in emails. I intend to do this by putting <img src="http://www.website.com/trk.aspx" /> into the email. The standard page supplied by Google is below. What I want to achieve is a redirect run at server to the image rather than display it on page, this will then hopefully work in email clients.

Please help, I'm a complete novice with anything other than plain old HTML and CSS.

<%@ Page Language="C#" %>
<script language="C#" runat="server">
// Copyright 2010 Google Inc. All Rights Reserved.
private const string GaAccount = "MO-1276714-16";
private const string GaPixel = "/ga.aspx";

private string GoogleAnalyticsGetImageUrl() {
  System.Text.StringBuilder url = new System.Text.StringBuilder();
  url.Append(GaPixel + "?");
  url.Append("utmac=").Append(GaAccount);
  Random RandomClass = new Random();
  url.Append("&utmn=").Append(RandomClass.Next(0x7fffffff));
  string referer = "-";
  if (Request.UrlReferrer != null
      && "" != Request.UrlReferrer.ToString()) {
    referer = Request.UrlReferrer.ToString();
  }
  url.Append("&utmr=").Append(HttpUtility.UrlEncode(referer));
  if (HttpContext.Current.Request.Url != null) {
    url.Append("&utmp=").Append(HttpUtility.UrlEncode(Request.Url.PathAndQuery));
  }
  url.Append("&guid=ON");
  return url.ToString().Replace("&", "&amp;");
}
</script>

<html>
<head>
<title>Email Tracking</title>
</head>
<body>
<% string googleAnalyticsImageUrl = GoogleAnalyticsGetImageUrl(); %>
<img src="<%= googleAnalyticsImageUrl %>" width="1" height="1" border="0" />
</body>
</html>
0

There are 0 answers