0

I use different ways to send events to Google Analytics on my website. Some user interface interations sends using ga.js but some user actions (eq.: succesful auth or transaction) is possible to send only from server-side (PHP) using measurment protocol. Events are both successfully sent and come to GA, but there's no link between JS and PHP events. For example, user entered website, clicked some buttons (stats sent by JS) and made a transaction (stats sent by PHP). After that i see JS events linked to one session but PHP event isn't linked. It just displayed as separate event. What information should i store and pass to measurment protocol to have that events linked?

aokozlov
  • 711
  • 2
  • 7
  • 21

1 Answers1

1

You need to send the client id (as set in the ga cookie, because this is the key GA uses to group visits into sessions) and possibly the user ip override and user agent override.

Eike Pierstorff
  • 31,996
  • 4
  • 43
  • 62
  • i tried passing all of that but anyway i see, for example, that user comes to website from search (this is passed by JS) but when user try to log in event sends by PHP and looks like "direct" in google analytics dashboard. – aokozlov Sep 25 '15 at 09:52
  • I see - this is probably because GA starts a new session when the marketing channel changes. You would probably have to pass the original marketing channel with your serverside call as well. – Eike Pierstorff Sep 25 '15 at 10:12
  • I was mistaken. I passed whole `_ga` cookie as `cid`, but actually `cid` is only part of it (last two groups of numbers with a dot in between). When i started to pass correct `cid` it started to work like charm! Thank you for your help. – aokozlov Sep 29 '15 at 12:16