Search code examples
emailgoogle-analyticsmeasurement-protocolclientid

where find clientid from console


I need to send some mails my users. I will send it from console, so I have not any user's cookies. And to track opening mails I insert img in letter body like this:

<img src="https://www.google-analytics.com/collect?v=1&tid={{UA}}&cid={{CID}}&uid={{UID}}..." alt="" />

How can I replace {{CID}} ? Where should I find it? Thanks


Solution

  • If you want this hit to be connected to an existing user from your website you would need to record the client id when a user signs up for your emails, maintain a database that maps the recorded id to the e-mail address and the actual substitution would depend on your mail script. Since in this case the clientid is created in your users browser the only possible source would be the cookie.

    If you just want to record a hit (without connecting it to existing users) then, as DalmTo pointed out, just use a random unique id.

    If you do not have a client id, but have a way to identify the user on your website then you could also try the UserId feature and session unification. In this case you would use a random client id and append your known user id as parameter.