Friday, September 30, 2011

Best way to track email campaigns

A lot of people are being concerned the latest years about their personal data and how all those information are being out there in the internet. The truth is that the majority of internet users are exposing themselves in a way they thing they control. But is this true? I doubt, but this ia a big big discussion and I am sure I can find statements in both lanes.
So let's move on the campaign tracking! It is so easy and your big ally is going to be an email campaign tool like Mailchimp (or any other email-campaign tool) and of course Google Analytics. The latest API of GA gives you the ability to track the basics about your campaign(campaign name,medium and source) but also gives you the ability to store up to 5 User Defined Variables. The power of user defined variables is insane! Imagine a scenario where you can send email to your list and afterwards track all the visitors activity and see who visited what and what information he liked most and so many other statistics. The big deal here is that you should not use sensitive information inside your google analytics like names phones or emails.
Alternatively you can use a random created user id that you generated for each user. So you and only you, know exactly who is visiting what.
At this point we must say that this is not legal unless you point everything inside your target site privacy policy. Also do not forget to add this policy link inside your email campaign content. Otherwise is like first applying your policy and then informing the visitor. So what you need to do that:
  1. On the call to action link add an attribute for each user. Preffered is a userid number which does not send any kind of sensitive data through internet.So if your page is http://mysite.com/my_landing_page.html convert it to http://mysite.com/my_landing_page.html?user_rand=[userid] (I do not include all the utm_campaign and the others GA campaign trackings which will be added automatically once you specify the campaign in your campaign tool).
  2. On the landing page you can read the GET variables with javascript and then you can set your new custom variable easily.
So inside <head> you should add the below code:

       function urlparam(name){
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return "";
else
return results[1];
}
var uid = urlparam('user_rand');
<script type="text/javascript">
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-MY-ACCOUNT']);
  _gaq.push(['_setDomainName', '.mydomain.com']);
  _gaq.push(['_trackPageview']);
_gaq.push(['_setCustomVar',
      1,                   // This custom var is set to slot #1.  Required parameter.
      'User Random ID',     // The name acts as a kind of category for the user activity.  Required parameter.
      uid,               // This value of the custom variable.  Required parameter.
      2                    // Sets the scope to session-level.  Optional parameter.
   ]);
 (function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
</script>

So you know which user show what and you will be able to contact those that interested more for your products.
Hope this helps cya soon!

2 comments:

  1. Hello,
    Your sites looking so nice.he liked most and so many other statistics.
    security software

    ReplyDelete
  2. I am looking forward towards this kind of post.This is one of the knowledgeable post.I like your post detail.
    Android app developers

    ReplyDelete