Google Analytics propagate source - javascript

I am using Google tag Manager and Google Analytics.
I have a link on my yelp page like example.com/?utm_source=Yelp.
What I want is to be able to track that source even if the user clicks on a different link on my website, say to example.com/new-article.
So if a user fills out a form on that page, I know the user came from Yelp.
Summary:
A customer goes from Yelp to example.com then clicks another link. How can I still know that the user came from Yelp?
One strategy is I can append utm_source=$_GET['utm_source'] on all links on my page, but I assume google analytics or google tag manager has already solved that problem. I'm having trouble finding information on this.

Source is a session-level dimension, so if a user comes to your site with a utm_source param in the URL, that source dimension will be applied to all hits (pageviews, events, etc.) in the session.
In other words, you don't need to do anything special to make this work.

Related

How to get Google Tag Manager Event Tracking to send to Google Analytics?

My website has a tel: link in the header, and I want to see in Google Analytics when this link is clicked, and on what page. I've decided to do this using Event Tracking in Google Tag Manager. So I made a tag, with the following configuration.
And this is my Trigger configuration.
This is the HTML that this is referencing, (note that I also tried to add an onclick attribute, which was meant to push Event data directly to analytics. This didn't work.)
This is the variable configuration used in this tag.
This is proof it fires in the GTM debug pane.
And this is the summary coming in when you click on the item withing the pane.
In Analytics, this is what I see in the Real-time events tracking.
And this is what I see under the events overview.
So the tag is firing correctly, but the information is not going over to Analytics. I can find no resource on the internet that addresses this issue. Has anyone successfully pushed Google Tag Manager event tracking into Google Analytics? If so, what did you do to make it work, and what am I not doing/doing wrong that is preventing me from the result?
The end goal is I want to track the page where the click happened in Google Analytics' Events Overview, and also in the Goals section.
Thanks for that link, Uda! What was going wrong was my Google Optimize Tag. I paused all tags except my click-tracking and my Universal Analytics

Impossible to track visits/referral from an iframe

We have created a website that sales online ferry tickets.
We also created an affiliate system and propose our booking engine to third party websites (via an iframe).
Ex: http://travelq.ru/s-krita-na-santorini-na-parome/.
Iframe url: https://www.ferriesingreece.com/affiliate_engine_small.php
Every time a user is searching from this engine (in iframe), there is a form submission to https://www.ferriesingreece.com/redirecting.php?aff=affiliate_name.
Problem:
We can not track visits (as referrals or as new visits) from third party websites.
Analytics do not count the clicks that comes from the iframe.
We thought it was an issue of the submitting form. So, we added a direct link to https://www.ferriesingreece.com in the iframe to test it and the result is the same. Nothing is counted.
Finally we think that this is logically happening because the iframe content belongs to https://www.ferriesingreece.com, and analytics record that the user is already in our site, so it shows up as a user is navigating in our site. (not a new visit, not a referral.)
Is there any way to track those visits/referals from an iframe?
Is there a way to add analytics code somehow in this iframe and be able to record only the clicks and the parent website as referal?
You should be able to use UTM URL parameters for this. For example, if you add the parameters utm_source=form&utm_medium=referral&utm_campaign=affiliate to your form's target, the visit should* show up in your analytics report as a referral from the source 'form'. It will also show up the 'campaigns' section of your report.
Read more about UTM here: https://support.google.com/analytics/answer/1033867?hl=en
The full target link to your form would look like this: https://www.ferriesingreece.com/redirecting.php?aff=affiliate_name&utm_source=form&utm_medium=referral&utm_campaign=affiliate

Is there a better way to track a redirect page with google analytics?

We are putting out a press release that contains links to our website and to other websites.
Right now I have a redirect.php on my website that is redirecting the user based off the variable located in the URL (e.g. redirect.php?id=1) using a meta refresh. Google analytics is loaded on the redirect.php so I can capture that visit and see where visitors are coming from before we redirect them to their final destination (either an internal page or an external page).
I do not like having to wait for google analytics to load before the user can be redirected.
Is there a better solution for this?
Here's how I would to it...
Take a look at How to Track Downloads & Outbound Links in Google Analytics
You have two kinds of links you want to track:
Links to other sites.
Links to your own site.
The how-to above will explain setting up clicks on offsite links as google analytics events (this is a better way to treat this activity than as page views).
You can then use the same basic methodology to track the clicks to your own site from within the press releases. You'll just need to find a way to select them in jQuery. Maybe by the id of the div contains your press releases, maybe you'll need to add a special class to the links you want to track. It would depend on how your page is set up.

How do i send clicks manually to google analytics?

I have a ToC with all the links in the format as "#id-link". I can generate the href as anything i want easily. However i dont think adding ?utm_source=... will send google analytics the click events (does it!? i was looking at How do I tag my links? at the time)
How do i send clicks to google analytics?
At any point you can send page views to Google using the TrackPageView command:
_gaq.push(['_trackPageview', '/document/sectionName.html']);
So in your ToC, for example:
Links

Google Analytics - how does it track clicks?

So I'd just like help understanding how exactly google analytics collects this info. I have a homepage and the statistics say that 46% of clicks are on the logo (which links to the homepage). Does google analytics just assume that if they've ended up on the homepage they have clicked there?
How accurate is this measurement?
I wonder because I have a link that opens a modal, but the modal window doesn't "reinclude" the analytics code. Yet it has 46% of clicks also (the href is "#").
Is there any info on how it works?
Google Analytics is inferring a click on a link when a visitor ends up on a page from a prior page. You can observer this easily by looking at a page with multiple links to another page, and looking at the clickthroughs they get. Google tracks them as the same.
For example, I am on Page A and Page A has Link 1, Link 2, and Link 3. Links 1 and 3 point to Page B, whereas Link 2 goes somewhere else. If 37 people click on Link 1, and 43 people click on Link 3, Google will tell you that 80 people clicked on Link 1, and 80 people clicked on Link 3. The traffic isn't double counted however. It is just Google's way of showing you traffic.
The first rule of analytics analytics are not 100% reliable.
That being said, some can be quite reliable, and, I tend to trust Google analytics more than most others.
How does Google analytics work?
How to Track Internal Links in Google Analytics using Asynchronous Tracking
Tracking clicks with Google analytics
Tracking Link Clicks to External Sites with Google Analytics

Categories