phpgoogle-analyticsgoogle-analytics-api

Can I add google analytic to an email (both html / text version)?


I am wondering whether i can add google analytic to an email. I want to check my click rate , open rate of my sent mail. I have done some research on this and I learnt that there is a track code should be useful.

So, Since now i am sending an html version email, is it possible to add the code into the mail?

Also, If i want to see the result of it , is it possible i do not need to login to the google page, but connect to their server and retrieve the result and show them on my php page?

Thank you


Solution

  • I would say NO on this question. You could of course add the Google Analytics script-snippet to your HTML email, but I believe most e-mail clients will block the JavaScript for security reasons. Thus leaving you with inaccurate data, at best.

    In your case, if you don't want to send your mails through MailChimp or some other third party service that does the tracking for you (they track both openings and clicks), I would implement my own "simple" tracking system. Each link in the email re-directs through a page that you are in control of, where you track the click and then redirect the user to the appropriate address.

    Update

    About getting data from your Google Analytics account, I believe you can use the Analytics Reporting API. Haven't tried it myself, but it sounds like what you are needing.