How UTM paramters reach to Google Analystics Website - google-analytics

I am bit confused, and need little help regarding UTM tracking parameters.
Standard syntax of UTM url is:
http://www.example.com/?utm_source=adsite&utm_campaign=adcampaign.
Lets say I embed this url as a link in my page. User clicks this link. Link is pointing to my website.
All utm parameters would reach to my website. How do they will reach to Google analytics website.
My guess is, Analytics code and js intercept all link clicks and extract UTM params and then let user defined click handler work with the click.
Could someone with right expertise would help me?.
Thank you very much for your time, really appreciated.

The UTM require following mandatory parameters:
http://www.example.com/?utm_source=adsite&utm_medium=admedium
utm_source and utm_medium are mandatory.
utm_campaign is not mandatory even if the documentation says otherwise.
Google Analytics automatically collects these parameters and automatically removes them from the URL so in Google Analytics you will see the URLs without parameters and the source / medium of the UTM.

Related

UTM parameters not set for my website with Firebase dynamic links

I have a need to shorten my website url and I choose Firebase Dynamic Links (https://firebase.google.com/docs/dynamic-links) for that. I also added UTM parameters while creating the link.
When clicked on the link, the user is redirected to the desired website, but these parameters are not getting passed to it. Hence by GA for the website doesn't track it.
Am I doing something wrong? Or Is Dynamic Links a bad choice for my use case?
UTM parameters that you choose in UI are parameters for mobile tracking. If you want to pass UTM parameters to your "fallback" website, you need to add them to the fallback address itself.
So to be covered in all cases you'd need to add UTM parameters in UI configuration (or as normal UTM parameters) and inside fallback link, for example:
Let's say those are your UTM params:
utm_campaign=spring_sale&utm_medium=cpc&utm_source=google
Your current link:
https://sample.page.link/?link=http://example.com?utm_campaign%3Drandom&apn=com.demo.firebase&utm_campaign=spring_sale&utm_medium=cpc&utm_source=google
Your new link with UTM embedded in web link (https://example.com?utm_campaign=spring_sale&utm_medium=cpc&utm_source=google):
https://sample.page.link/?link=https://example.com?utm_campaign%3Dspring_sale%26utm_medium%3Dcpc%26utm_source%3Dgoogle&apn=com.demo.firebase&utm_campaign=spring_sale&utm_medium=cpc&utm_source=google

How to pass gclid parameter manually in JS to Google Analytics

I have a website build with one of the most amazing frameworks on the world. Unfortunately it has one downside. It does not allow to use query parameters, for example: www.url.com/page/1 is ok but www.url.com/?page=1 is not ok. When you put this URL it uses browser history so there is no query parameters left in URL.
I have a campaign in Google Adwords that directs users to this website. Auto tagging is on. I've noticed there are 10k clicks to my website, but Analytics does not report such number for Adwords source.
I discovered that Adwords auto tagging is adding gclid parameter to the destination URL. Than, Analytics knows everything about the campaign because Analytics and Adwords are linked together and i should have pretty analytics data on campaigns and their conversions.
But i don't have it. Since my one of greatest website frameworks removes with its JS code the gclid parameter, Analytics does not notice the gclid and not save the source of the user.
To check if it is really my great website framework issue, i've added utm(umt) parameters to my website and checked source in real time in Analytics. It was not reported as source i provided in parameters but a direct visit.
I would like to be able to analize Adwords performance in Analytics. I can not change unfortunately my framework because it is one of the greatest on the world. But i have noticed that before JS code of the framework is fired i have for a while a URL with the parameter gclid.
Some lines below i have my Google Analytics tracking code. Obviously it tries to get gclid from the URL. But it is too late for him. The gclid parameter is gone when Google Analytics tries to read it.
So my question is: since i have gclid, is there any method of Google Analytics to pass it to him? Like say:
var gclid = getGClidBeforeItsToLate(); // i have it covered
// Awesome framework stuff
HeyGoogleAnalyticsHereYouGoItsYourGclidTakeCare(gclid);
?
Override the "location" field and append the gclid parameter.
if(gclid) {
ga('set', 'location', document.location + '?gclid=' + gclid);
}
ga('send','pageview')
You have to use the location field, not the "page" field (which takes the page path), since the latter does not change attribution even if you add parameters t the path.
If you have manually set campaign parameters ("utm parameters") you could set them via the campaignMedium/campaignSource/campaignName fields, but since you cannot get the individual campaign values from the gclid you have to overwrite the location (at which point GA will dismiss what it has gathered from the address bar of the browser and use the value you passed in).

Track foreign url using google analytics

I have a URL(https://www.mysite.com/tab/subtab/) that belongs to my website(https://www.mysite.com/). Clearly, to track clicks on this url, all I have to do is append the utm_source, utm_medium and utm_campaign parameters to it. Now, what I want to do is, track a url http://www.notmysite.com/tab/subtab/. This url is neither a part of my site, nor is it mentioned any where in my google analytics account, only the link is available for modification. If I append the utm_* params here, the "clicks" information goes to the http://www.notmysite.com website owner's GAQ account and not mine(obviously!). What parameters should be appended to this foreign url, so that I can track the clicks on it?
If this is not possible with google analytics, are there any other options?
Thanks
You will want to look into event tracking to track clicks on links.
https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide#Anatomy
Taking an example from Google's doc:
Click here
Any clicks on that link will now appear in Analytics under Content -> Events. Notice though how I added target="_blank" which is needed for ensure the accuracy of events for external links due to there not being enough time to send the data to Google. A workaround is to add a delay via javascript which is a better approach if you're tracking more clicks.

google analytics and lead capture

Here is what I am trying to achieve:
I have a landing page with a lead capture form (Name email phone). I am running adwords campaigns to capture these leads.
I want to know is there any way I can tag each lead with the keyword and campaign it came through. This way i will be able to know which campaigns are generating quality leads for me.
If there is any sample code available it will be great.
P.S My campaigns are autotagged so I can't capture data from URL and UTM parameters.
You just need to define a goal on that lead.
You can define this goal :
on the URL where your visitor are redirect after the form validation if there is one
if not on an event you wil add on form submit
Then get all the statistics in the Analytics Advertising reports.
note : don't forget to activate autotagging on your Adwords campaigns.

Custom Google Campaign Tracking

I'm building out a site that has predefined affiliate ids that are driving traffic to our sites. We currently use this paramater to track our seo work internally. Now we want to do the same through Google's Campaign Tracking at the Session level. The problem is we don't want to change our url, is it possible to manually build the Google campaign tracking pixel url? I'd like to take our affiliate ids and convert them over to a tracking campaign pixel for Google.
Seems like Google built this so all the tracking data must be in the url, is there a way to do the same tracking w/o the google data in the url?
Instead of:
http://www.mypage.com/?utm_source=google&utm_medium=cost-per-click
I want to use(javascript will do the rest):
http://www.mypage.com/?affid=123456
Turns out here is exactly what I was looking for:
https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiCampaignTracking
This is essentially doing everything the Google Campaign Tracking does but you have full control over what parameters are passed in the tracking pixel. I don't have to change or mess with the url, our in house tracking will work as it should, and now the google tracking pixel will be built as I specified.
You can programmatically set up a virtual pageview based on the affiliate id.
In an if statement, determine if you have an affiliate id. If you do, write some logic to build out the proper campaign, medium and source, then concatenate it to your URL. Pass that to GA via the trackPageview method instead of letting it do it's own thing.
Keep in mind that passing a virtual URL does replace it's default behavior, so you won't have the affid parameter in your content reports unless you build it in to the virtual pageview.

Resources