AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

Analytics
1.7K members online now
1.7K members online now
Learn how to set up goals and Ecommerce tracking, verify accuracy of attribution traffic sources, and discuss funnel visualization, Multi-Channel Funnels, the Goal Flow Report, and Enhanced Ecommerce
 
Guide Me
star_border
Reply

Keep GTM cookie with a 302 redirect

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi,

I need to track hotel reservations with the following scheme :

Site A (http)     *>>     Site B (https)       **>>      Site C (https)

  Hotel's site                   a-second-domain.com                  final-domain.com

* form submit

** 302 redirect

 

The context is that we implemented the GTM tracking code on sites A and C. I want to keep the source of a transaction (so I would be able to know if it is organic, direct,...), but currently we lose the GTM cookie during the redirect that takes place on the Site B : all our transactions are tracked as from the Direct source. I know the traffic source becomes "direct" right after the redirect from the B site to Site C.

 

Which solutions could help me keep the cookie between these three sites ? Knowing that it might be complicated to ask our client to add the GTM tracking code on the site B.

 

If I forgot any information just let me know. Thanks by advance for the help !

 

1 Expert replyverified_user
1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Siona A
April 2016

Re: Keep GTM cookie with a 302 redirect

Rising Star
# 8
Rising Star
What I see executed is ga("gtm1461079176981.linker:autoLink", ["www.phgsecure.com", "gc.synxis.com", "www.hoteldeparis-sainttropez.com"], false, false)

Looks like you have decorateForms set to "false" in GTM (which is the default setting). Switch to True.
_________________________________________________________________________
Director of Marketing | Nehmedia | Partner Profile

View solution in original post

Re: Keep GTM cookie with a 302 redirect

Rising Star
# 2
Rising Star
Cookies actually don't cross domains. Cross-domain tracking works because (and this is automated when set up properly in GA) because tracking data is appended to the URL -- this is called link decoration.

Here is a more detailed explanation: https://developers.google.com/analytics/devguides/collection/analyticsjs/linker#autolink

If there is no tracking code on Site B, then you lose this. You have to have tracking code on Site B or add the values to the redirection manually. Do your visitors view pages on site B?
_________________________________________________________________________
Director of Marketing | Nehmedia | Partner Profile

Re: Keep GTM cookie with a 302 redirect

[ Edited ]
Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Thank you for your answer. I know we don't have access to the analytics of the site B . Below you can find a detail that might help.
The site A has a reservation form with an action attribute as follows :
<form action="https://www.phgsecure.com/IBE/bookingRedirect.ashx?propertyCode=LTTDP&amp;locale=fr-FR" method="POST" target="_blank">
The URL in action attribute is the site B.
The treatment on that page is fast (it doesn't allow me to search for a tracking code). It fastly redirect me to the site C.
Is the only solution to ask developers to add also the GTM on that treatment site ?

Re: Keep GTM cookie with a 302 redirect

[ Edited ]
Rising Star
# 4
Rising Star

From what you are saying, you can't do anything on site B? 

I tested adding a variable to your B URL example in an form post action and it was passed to the C domain (propertyCode=LTTDP&amp;locale=fr-FR&foo=barn). This tells me that in all likelihood if you follow the excellent guide at http://www.lunametrics.com/blog/2015/06/16/cross-domain-tracking-with-google-tag-manager/ you should end up with the _ga  in your url on site C.  

You should see something like: &_ga=1.142301170.1935433083.1457894596 in the final URL if you set up site A properly.

This value would be appended to the form action on A and it appears your server redirects will rewrite additional query string values.  This would mean that, outside of setting all three domains in the Auto Link Domains you should not have to do anything else on site B.

_________________________________________________________________________
Director of Marketing | Nehmedia | Partner Profile

Re: Keep GTM cookie with a 302 redirect

[ Edited ]
Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭

Thank you for the tutorial but I had already set up the allowlinker (I think I was using the same tutorial). When I do my GTM preview test, the Referrer URL of the C site is actually the site A, which seems strange because it would be logical to see the site B as referrer.

Maybe the site B loads too fast so it doesn't allow the autolinker to take effect? Here is my site A : http://www.hoteldeparis-sainttropez.com

The domains I included in the constant Auto Link Domains GTM variables are : www.phgsecure.com, gc.synxis.com, www.hoteldeparis-sainttropez.com

The uniqueEventId changes when the reservation form is submited / I am redirected to the site C.

Re: Keep GTM cookie with a 302 redirect

[ Edited ]
Rising Star
# 6
Rising Star

I am not seeing the form on Site A decorated. You need to add www.phgsecure.com to auto link domains.  

_________________________________________________________________________
Director of Marketing | Nehmedia | Partner Profile

Re: Keep GTM cookie with a 302 redirect

Visitor ✭ ✭ ✭
# 7
Visitor ✭ ✭ ✭
The form is in the slider right under the navigation menu bar (left side). There is a button "Réserver".
I did add that domain already, that is why it is strange.
Marked as Best Answer.
Solution
Accepted by topic author Siona A
April 2016

Re: Keep GTM cookie with a 302 redirect

Rising Star
# 8
Rising Star
What I see executed is ga("gtm1461079176981.linker:autoLink", ["www.phgsecure.com", "gc.synxis.com", "www.hoteldeparis-sainttropez.com"], false, false)

Looks like you have decorateForms set to "false" in GTM (which is the default setting). Switch to True.
_________________________________________________________________________
Director of Marketing | Nehmedia | Partner Profile

Re: Keep GTM cookie with a 302 redirect

Visitor ✭ ✭ ✭
# 9
Visitor ✭ ✭ ✭
Thanks a lot, it allows site C to keep the cookie ! But in my Analytics real time dashboard, the reservation URL is considered as from Direct source, despite the GA cookie being passed to the site C URL and the source was Organic at the beginning. What is changing the source ? Can it be the fact that the form opens a new window ?

Re: Keep GTM cookie with a 302 redirect

Rising Star
# 10
Rising Star
Have you included www.hoteldeparis-sainttropez.com in your referral exclusion list in GA? https://support.google.com/analytics/answer/2795830?hl=en
_________________________________________________________________________
Director of Marketing | Nehmedia | Partner Profile