arecki
arecki

Reputation: 11

Tracking Pageviews based on Referrer

My goal is to track a user session when a visitor is sent from a specific website.

I would expect visitor from 2 websites: a.com and b.com

I would want trigger a tag 1 if referrer contained a.com and trigger tag 2 if referrer contained b.com. Once a user lands on my site, they would be expected to travel around many pages on my domain. I still would need to track that session even though the HTTP Referer is no longer matching a.com.

My goal is to track how many of these sessions get sent from a.com, how many from b.com and how many reach of each reach a thank page at /thankyoupage

How would this be configured ? Would this require session scope and if so, how would this be configured ?

Upvotes: 0

Views: 1438

Answers (3)

raja pateriya
raja pateriya

Reputation: 341

As per my understanding, you want to have cross-domain tracking and want to track below thing:

Page 1of a.com --> Page 2 of a.com --> Page 1 of b.com --> page2 of b.com

By default whenever the domain changes User's GA ID is changed. So for a.com and for b.com GA will treat the same user as different, so by default, you cannot track such things.

To track above scenario GA should consider that the user on both the site is same And to do that GA provides Cross Domain tracking using Linker

https://developers.google.com/analytics/devguides/collection/analyticsjs/linker

Upvotes: 0

XTOTHEL
XTOTHEL

Reputation: 5208

I don't think you need to do any configuration for this.

For referral traffic, you can see the acquisition report. It should show up with a source as a.com and b.com.

enter image description here

for reaching the thank you page, I'd suggest you set up goals based on the arrival of the thank you page. enter image description here

Upvotes: 0

Eike Pierstorff
Eike Pierstorff

Reputation: 32760

If you just want to see this in Google Analytics you can create a segment with referrer a.com or b.com (mind that in GA the referrer is a traffic channel and only filled if there are not campaign parameters present on the landing page url). So for Analytics you do not need extra work. Traffic channels are automatically in session scope (as a change in channel starts a new session).

If you want to fire a tag conditionally based on the referrer it get's a tad more complicated. GTM does not maintain sessions, and does not, by itself, transfer information between page views. So you need to store the info yourself.

You would use the built-in referrer variable in a trigger that fires a tag if the referrer does not match your own domain. You would use that to fire a custom html tag with a Javascript function that sets a cookie. You then set a cookie with the referrer.

On your thankyou page you use the built-in cookie variable to read your cookie. If the cookie contains a.com or b.com respectively you use that for triggers that fire the appropriate tags (pageview trigger, fire on some pageviews, filter "[your cookie variable] equals a.com" (or b.com)). Since cookies are domain specific this only works when your thankyou page is on the same domain.

Upvotes: 1

Related Questions