Analytics
5.3K members online now
5.3K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

Handling server-side UTM tracking

[ Edited ]
Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hello,

I am trying to configure my Google Analytics integration in server-side. UTM tracking is quite confusing in here. Here are some questions which I am seeking answers for.

1) How UTM mechanism works actually? For example, when user comes to the website with utm queryString, I know classic javascript code will save this traffic and campaign information to cookies. That's ok. But I want to know that, in each analytics call (event, pageview or etc whatever), are these utm parameters send to google, even user starts to checkout, or completes an order, or goes to another pages in website without utm queryString?

2) I learned that utm cookies saved for 6 months. With question 1, if user comes to the website after several weeks, is he still count on this campaign? What if user comes to the website with direct access? How google handles this?

3) Now, How can I implement this UTM approach in server-side? What is the best practice for this? I think the easiest approach is saving (or rewriting) utm queryString to cookie (or sth different environment) for each page request, then use it in all analytics call. But I am not sure if this is correct or not.

Thank you in advance. 

Handling server-side UTM tracking

Follower ✭ ✭ ✭
# 2
Follower ✭ ✭ ✭

Hi ,

 

To answer your question

1) The campaign parameter will be set to that session, so you if you segment by campaign name you can see entire user journey.

 

2) Google always use the last source of entry to the website. So if user access the page directly for the second time then that session will be attributed to direct traffic.

 

3) You can manipulate the utm parameter using cookie (I never tried this before)

 

Thanks

Sura

Handling server-side UTM tracking

Top Contributor Alumni
# 3
Top Contributor Alumni

Hi 

I am guessing when you say server side integration you are referring to measurement protocol. For clientside tracking utm parameters are parsed from "dl" (document location" field in which entire URL is sent. For measurement protocol I believe you will need to set it with campaign parameters "cs", "cm", "cn", etc

 

All of these values are attributed to a session the same way the are attributed on client side. Session definition also remains same unless you override it with session controls. 

 

There are no more UTM cookies now there is only one _ga cookie which actually does not store values for UTM parameters. 

 

I believe best way to handle this with measurement protocol is by passing campaign parameters ("cs", "cm", "cn", etc) via measurement protocol on 1st hit of the session and then using session control parameters sc=start and sc=end to match tracking session with your server side session.

 

Hope this helps

 

Regards, Nik
LinkedIn  |   @nikhilparachure | My Blog