Tracking clicks with Google Analytics on a link to AppStore - google-analytics

Tracking clicks with Google Analytics:
I am trying to track clicks on a download button on my site (wordpress) that takes users to the AppStore.
I set up a goal and changed the button code to the following:
<a onClick="ga('send', 'event', 'AppStore', 'Click', 'top-button', '0');"href="
www.example.com">Download on the App Store</a>
and nothing is tracking. (By that, I mean that website visits are tracking but not clicks)
I have come across this support article (https://support.google.com/analytics/answer/1136920?hl=en) that seems to imply that outbound links need an additional tracking code installed in the site's header, so i've added that in, and still no clicks are being tracked.
The support article also seems to mention that outbound links should be tracked as follows:
Check out example.com
I am confused as to what code I should be using on the button to be able to effectively track clicks.
Advice please!

Related

How To Include a cookie-id when tracking events

I am completely new to Google Tag Manager. I have gotten it installed on my site, and it is working to count the number of clicks on the register button.
However, what I really want to do is this:
A user lands on the page. I want to place a tracking cookie for the user, and then log the page view along with the tracking cookie ID.
The user then clicks the register button. I then want to track the click event along with the tracking cookie ID.
By including the tracking cookie information, I can then easily see that User A landing on the Page at 10:00, and then at 10:02 Clicked on the Register Button.
It gives a clear picture of what happened on the site. My goal is to drive people to the site through adwords, but I then need to see exactly what happened with these people and how long they were on the site.
Can I do this with GTM/Google Analytics? If so, how? If not, is there some other tool for this?
Take a look at the User Explorer report in Google Analytics.

how to count clicks on tieh wordpress and google adwords

On my site
www.intro.co.il
it's on maintenance but there is a catalog to download.
I need your with which code i need to put on my wordpress site so i can know the amount of click on the download catalog button in my google analytics account
I have tried the call center support and they told me to try here.
thanks a lot!
Easiest (not necessarily most elegant) solution is just to track an Analytics event in the onclick handler of your button.
Something along the lines of
<button onclick="ga('send', 'event', 'Catalog', 'Download')">
This will let you see the number of clicks on that button in the Events view in Google Analytics.

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.

Site is showing up as a referrer to its own domain in Google Analytics reports. Why?

I am having two GA reporting problems with a site I manage that I am not sure how to solve:
The site is showing up as a referrer to its own domain in GA reports.
My goal completions (sales conversions on 3rd party off-domain
ecommerce cart) are all showing the site's domain as "source" when I
obviously want to see the true "referers" who are sending traffic
that results in goal completions.
My thoughts on potential reasons why this could happening:
I am using absolute paths for internal links, like this:
<a href="http://example.com/contact.html">
as opposed to
<a href="/contact.html">
Could this be it? Users often do click around internally before they purchase.
Also, on several high traffic pages, I am using javascript history backlinks, like this ::
go back
Lastly, I'm doing a 301 redirect on "add to cart" traffic clicks so that
http://example.com/add_to_cart
redirects to:
http://paymentprocessor.com/ugly_url/cart_page.html
(Although this is an external 3rd party domain, my GA code still fires there)
Any guesses why I am experiencing the issues stated at the top here? ... thank you to all you GA wizards.
UPDATE UPDATE UPDATE
Thanks Eduardo for the great answer.
Thought I might share that now for href text links to 3rd party ecomm site I am tracking events with jquery via class, so my _gaq.push to track both the click event and copy the cookie data over from my site to the third party site looks like this:
$('a.index_addtocart_smallest').click(function(){
_gaq.push(['_trackEvent', 'Outbound Links', 'index_addtocart_smallest', 'buy_click'],['_link', 'ssl.thirdpartyecom.net/order/']);
});
And when I use the form action "add to cart" submit in the HTML look like this:
<form action="http://example.com/add_to_cart" method="post" onsubmit="that=this;_gaq.push(['_trackEvent','Outbound Links','index_big_buy_button', 'buy_click'],['_linkByPost', this]);setTimeout(function() { that.submit() }, 100);return false;">
... to track the event, and post the existing cookie to third party server, while adding a delay to the click to make sure it is captured by GA.
In my case I am using the asynchronous syntax for Tracking Between a Domain and a Sub-Directory on Another Domain: https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingSite#domainAndSubDirectory
In your case it's very clear that the problem is with the cart. When you redirect the user to your cart domain he lands on a new domain and lose access to the cookies that he was using on your site. Because GA needs to create a new set of cookies on the cart site it also creates a new visitor id and a new visit, that visit will be a self referral because that's where the visitor is coming from from GA point of view.
Google Analytics keeps state on cookies, __utm*. So when changing domains we need to copy the cookies from the domain you are currently in to the domain you are moving to. The google analytics API offers some methods to implement this. This is often known as "cross-domain tracking" or "multiple domain tracking". Google Analytics documentation offers a good explanation on how to implement it. You can also search Stack Overflow for several questions related to cross-domain tracking, people seem to have a hard time getting it right.
You are free to use absolute or relative links, it makes no difference for Google Analytics at all.
Javascript redirects are usually ok. Even though there are cases where they certainly make things a little bit more difficult your use case of a back button is fine and should not be causing any problems at all. Of course if the javascript redirect changes the domain you are in you are back to the same issue and needs to implement cross-domain tracking.
Sometimes internal referrers are legitimate. One example of legit self referrals: When a user visits a page on your site and stay there for over 30 min, then navigates to a second page. In that case after the 30 minutes the visit expires and when he navigates to that second page a new visit is created. This new visit will be a self referral and the second page will be considered a landing page. That might seem odd at first, but this is a self referral and it's usually fine.

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.

Resources