Google Analytics

Pages

Friday, May 21, 2010

tracking emails traffic with Google Analytics

It is relatively simple to track traffic from any emails you send. You just need to add some information at the end of the links you include in your email.

Example: I want to track clicks from my email signature.

Current link:http://www.netleap.co.uk
New link: www.netleap.co.uk?utm_source=EIDE&utm_medium=email&utm_campaign=Reply

Details: 
utm_source: the actual source, I put my name to specify that the email comes from me
utm_medium: the actual medium. Here it is email
utm_campaign: gives you the opportunity to be more more specific. I have 2 different signatures, depending on whether it is a new email, or a reply email. I put "Reply" in my reply email signature.

What's next
- Each employee of your organisation can have a custom web link, to track who is driving traffic to the company website.

Monday, May 03, 2010

mysql triggers

Mysql triggers can help keeping your code clean and simple. Some application logic can be stored directly into the mysql engine, and here is an example I have used recently:

I have got 2 correspondence tables, refering to the same object, but representing 2 different interface implementations.

What I want is that when a record is added in 1 table, it also creates a corresponding record in the other table. Here is how to do it with a simple trigger (I have added a test on the status column, to make the insert conditional):

DELIMITER $$

DROP TRIGGER /*!50033 IF EXISTS */ `mytrigger`$$

CREATE TRIGGER `mytrigger` BEFORE INSERT on `table1
FOR EACH ROW

BEGIN
    IF NEW.STATUS = "new" THEN
              INSERT INTO table2 (MY_ID, STATUS, CREATED_AT) VALUES (NEW.MY_ID, NEW.STATUS, NOW());
          END IF;
END$$

DELIMITER ;
.

Share it