0

I want to use google analytics to track my e-mail opennings. It should be quite easy, there is a relative good documentation on it. It is a simple URL with parameters inside a <img> tag. My problem is that one of the parameters has to contain a random number.

Here is an URL example:

<img src="http://www.google-analytics.com/collect?v=1&tid=UA-12345678-1&cid=CLIENT_ID_NUMBER&t=event&ec=email&ea=open&el=recipient_id&cs=newsletter&cm=email&cn=Campaign_Name />

The CLIENT_ID_NUMBER must be a random number for each e-mail. How do I change it dynamically using only HTML, since e-mails do not support javascript?

Thank You Very Much

Ciro Shia
  • 67
  • 2
  • 6

2 Answers2

3

as @Robert Wade said, you can pass the "CLIENT_ID_NUMBER" from the server side language which you may be using to generate your <img> tag.

For Ex: If you are using PHP, then it will be something like below :

$client_id_number = // your generated unique number;

Then append this variable in your img tag

echo '<img src='"http://www.google-analytics.com/collect?v=1&tid=UA-12345678-1&cid="'.$client_id_number.'"&t=event&ec=email&ea=open&el=recipient_id&cs=newsletter&cm=email&cn=Campaign_Name />"'>;

and send it in your email. Since you can't use Javascript, you will have to use a server side language to make this happen. For adding dynamic behaviour, you will have to use some kind of programming language either JS or anything else because HTML itself doesn't provides logic. Hope this helps you.

Mr Lister
  • 45,515
  • 15
  • 108
  • 150
5eeker
  • 1,016
  • 1
  • 9
  • 30
0

You can't do that with HTML only. HTML is used for the structure of your page. It's not a programmation language.

Community
  • 1
  • 1