Track foreign url using google analytics - 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.

Related

Google Tag Manager. Tracking link click through a funnel

I had a question about Google Tag Manager. (I also felt bad for having the IT guy fix my mistakes on my simple click tag)
I wanted to track when a user enters a specific url when they click a link button on the homepage.
This is what it looks like
Image
This is my idea on what the Tag and Trigger should look like
Image
But I'm worried about having the trigger be fired when there is another page in the funnel
Also if the only way to do this is in the goal feature of GA that is good to know also. (I currently don't have the permissions here)
Thanks for responses
While it is difficult to achieve exactly what you're describing (it would involve storing data in cookies and then using these cookies to conditionally fire tags), there is a better way to achieve what I assume is your ultimate objective: an analysis of the shopping funnel.
Specifically, the Google Analytics enhanced ecommerce module has a dedicated report (the Conversions > Ecommerce > Shopping Behavior report) that shows you exactly this. It shows you the number of sessions for each stage of your shopping experience (product view -> add to cart -> checkout -> purchase) along with drop-off rates and volumes between each of these steps.
It is a little bit more involved to implement enhanced ecommerce but the final result is definitely worth it for an ecommerce business. Instructions for implementation of enhanced ecommerce (using Google Tag Manager) can be found here.
GTM is hit based without any notion of persistence. So by default this will not work.
You would need a custom HTML tag with a javascript function that sets a cookie, or writes a value to localstorage, when the button is clicked.
Then on your destination page you can check if the cookie exists and fire the tag accordingly.
I don't think the goal feature in GA can do that, either. A goal is registered when you hit a destination URL or event, you cannot specify conditions other than the destination.

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).

Google Analytics Tracking Conversions with vendor data and custom campaigns

Please help me understand this. I have a client for whom we created a sweepstakes "mini site". Traffic was generated through banner ads, eBlasts, and newsletters. For the banner ads, I created custom urls, i.e. www.somewhere.com?utm_source=yahoo?utm_campaign=abc to track the traffic to the landing page per vendor/banner. this works just fine.
The entrant visits the page, signs up for the sweepstakes, has as double opt in email process for verification. All of my entering traffic to the landing page is tracking fine, and is properly broken down by utm_source and utm_campaign.
Some of the vendors had me place tracking pixels on the confirmation page for conversion statistics. The only info I have placed for internal tracking on the confirmation page is the GA tracking code.
I have been told to create tracking pixels to track the individual vendor conversions. Is this possible without the originating pixel data from the vendor? I am new to tracking pixels, but my understanding is that I need some information from the vendor in order to write the code for the pixel. Am I wrong?
I can't understand how we can place a tracking pixel on our end without at least campaign name or data from the vendor's tracking pixel that they placed on the page containing our banner ads.
What am I missing here? How can I actually separate the conversion traffic from the different sources when everyone receives the same double-opt-in email?
Please ask me to clarify if I am not being clear. Thanks in advance for reading my question.
There are two things you are trying to track here. One is Campaigns: Campaigns are how you measure the effectiveness of techniques to bring users to your site.
The other thing you are tracking is Events - this is what users are doing once they arrive at your site. If you want to track individual vendor conversions, you should add an onclick handler to either the submit button, or link that you are calling a "conversion"
For example:
Your link here
If you are adding the push to a form submit, you might want to have that push happen on the pageload of the success page, rather than the onClick of the submit (otherwise it will track the event, and it might not have actually happened due to form validation errors for example)

Google Virtual Pageview Setup

I need some help with the setup of tracking virtual clicks on a submit button. What I need to do is get the referring site, which Google already tracks, and then track if they click on the button. I have setup an onclick for the submit button and setup a goal in Analytics but it is not tracking. I do have the code in place for Analytics in my header to track pageviews.
So what I am trying to do right now with my goal is to track a referring website and then track who clicks on the button. The virtual view I am using for the click is:
onclick="pageTracker._trackPageview('/Orders/Subscription');"
Thank you for any help in getting this setup working. I am still working on learning analytics.
If you want to ...get the referring site, which Google already tracks at the time the user clicks the submit button, you will have to read the cookies (the _utmz in this case) that GA sets and extract it from there.
Referral data can be obtained from the reports in GA, but if you want it at the time of submit, you'll have to get it from the cookies. Plain vanilla javascript can do this for you, just google it. Or, use whatever language your pages are written in to extract the data from the cookie (PHP and many others have this capability).
Regarding tracking the virtual page view, if the user can submit your form by hitting the enter key, then onclick is not desirable. onsubmit in the form tag would be better.
If it is still not recording for you, make sure your goal steps are entered into GA correctly (it's quite common to mess this up and GA is not forgiving to even the slightest error) and that you are using the traditional tracking snippet in the head of your document because your example is in the traditional tracking format. You should not mix async and traditional snippets.
To check if GA is even tracking your virtual page, go to the Content, Top Content report and filter by your virtual page. If it's in there, then it's your goal tracking set up. If it's not in there, it's your virtual page tracking on the form itself.
HTH.

tracking users with google analytics after they leave my domain to make a purchase and come back

I would like to track where users originally came from when they make a purchase on my site so I know which keywords are more profitable and which websites are best for advertising.
an example is a user is on my site with my google analytics tracking code which has details of where they came from, and then decides to upgrade. they leave my domain to go to my biller (2checkout) complete the purchase and return to my thank you page.
I have transaction code and analytics code on my thank you page and the transactions are showing up with the correct product/amounts in GA however there is no other data and in my reports the referring url is always my biller or a credit card companies authorisation page.
i can manually connect which customer is which by saving their referring data when they first come to the site and then matching it up after they make a sale, but I would like it to show up in my google adwords / analytics account where it is easier to manipulate the data and see trends.
if anyone can help me with this annoying issue I would be vbery greatful, but I fear I may end up living off reports I create and then matching them up with adwords manually :/
One thing you can do is have a click event trigger a custom variable. When the user clicks on whatever link that takes them to your biller, have the custom variable trigger with the information you want to carry over (like the current page URL, some campaign name, whatever). Specify the custom variable's scope as Session or Visit so that it get associated with the thank you page.
http://code.google.com/apis/analytics/docs/tracking/gaTrackingCustomVariables.html
An alternative is to do campaign tracking:
http://www.google.com/support/analytics/bin/answer.py?hl=en&answer=55540
That is more or less the same principle as the first suggestion, but with using specified URL parameters. Depending on how your pages are actually coded, you may need to push a virtual page view with the campaign code(s):
http://www.google.com/support/analytics/bin/answer.py?hl=en&answer=55521

Resources