title: Google Analytics: Connect acquisition data with server side reporting
body: <p>We have a system where user can arrive from multiple domains to an application system, and we would like to track their activity. The application system consists of several steps, and we would like to see, which utm_source brought in the most advancing candidates.</p>
  
  <p>This can only be known on the backend, thus I'm using server-side event sending for GA.
  I transfer to the backend:
  _ga, _gid cookie values (from which we can extract the cid and gid parameters for the call. Is this a correct approach at all? I'm not 100% sure that cid and gid parameters should be filled from those values.</p>
  
  <pre><code>        MultiValueMap&lt;String, String&gt; body = new LinkedMultiValueMap&lt;&gt;();
          body.add("v", "1");
          body.add("tid", trackingId);
  
          // coming from the cookie _ga
          // ga id is like GA1.2.1051421203.1507107210
          // from that, we need: 1051421203.1507107210
          body.add("cid", cid);
  
  
          // coming from the cookie: _gid
          // _gid GA1.2.2063422210.1507532018
          // from that, we need: 2063422210.1507532018
          body.add("gid", gid);
  
          body.add("t", "event");
          body.add("ec", "Button");
          body.add("ea", "Click");
          body.add("el", label);
  
          addIfNotEmpty("cs", application.getUtmSource(), body::add);
          addIfNotEmpty("cm", application.getUtmMedium(), body::add);
          addIfNotEmpty("cn", application.getUtmCampaign(), body::add);
  
          log.debug("Sending event: {}", body);
  
          restTemplate.postForLocation(ANALYTICS_URL, body);
  </code></pre>
  
  <p>As far as we have the UTM source, fields filled, we can use it to link the data with our campaign in GA.</p>
  
  <p>My question is:
  How does Google Analytics link together the domain changes? I've read a bunch about cross domain linking, but did not find any good solution on what to do if the receiving site is a backend app.
  I could use</p>
  
  <pre><code>ga.getAll()[0].get('linkerParam')
  </code></pre>
  
  <p>and transfer to the backend, and use it for event propagation, but that does not do the auto-linking. What any other params should be passed through to link the domain change?</p>
  
  <p>Is there a way to make Analytics know about the user flow, without moving every time the utm_source, utm_medium, utm_campaign values? Shouldn't this be done by only sending the cid / gid correctly? If yes, where does this value should come from?</p>