0

We have recently started to investigate some server-side tracking in my organization. I had a developer install the “theiconic” measurement protocol library for PHP and build a module for Drupal, that sends pageviews directly to GA. Works like a charm so far. We would however like to make full use of what is measurable client-side as well as server-side by stitching client-side and server-side information based on a shared transaction ID that is unique to the specific session or page request.

1st of all: Does anyone else have experience with using theiconic’s php-ga-measurement-protocol library for server-side tracking?

2nd of all: Does anyone have experience with stitching client-side and server-side information together based on a unique session or transaction ID of some kind?

Hopefully, someone has a few tips on this, as I don’t know where to start with the latter. Cheers.

Morten
  • 1
  • 1

1 Answers1

0

You're using Universal Analytics at client side and Measurement Protocol API at server side.

To stitch the sessions, you'll need to send the ClientID with each Measurement Protocol hit, which is done by passing the 'cid' parameter.

Since you're using theiconic library, you can send it with:

$analytics->setClientId('12345678')

The ClientId needs to be captured from the client side, through javascript, and then passed to your server side:

ga(function(tracker) {
  var clientId = tracker.get('clientId');
});

You'll need to figure out the best way to send the ClientId from client side to server side (and then how to store it for the session).

  • Alright, thanks Manuel. Have you succeeded in tying up the client-side and server-side information? This will at least make it easier when talking to my developer about it. – Morten Nov 12 '20 at 14:11
  • Yes, I'm using this solution in production for a few years without any problems. – Manuel Capinha Nov 13 '20 at 23:53
  • Alright, cheers. And what kind of information about the user/session are you typically sending from the server and what information from the client? – Morten Nov 17 '20 at 07:19