I have a website and I'm using Google Analytics.
I have widgets for popular posts, latest posts, posts list, etc...
I want to know if the user clicked on the link in the popular posts widget or the latest posts widget, for example, before getting to that post page.
I can change the link to something like:
example.com/post?ref=popular
example.com/post?ref=latest
example.com/post?ref=search
But I don't want those to be treated as different pages.
How can I do that?
Given that you are looking to simply count the number of times someone clicks on the links, then you want to use Google Analytics Event Tracking: http://davidshawblog.com/2013/01/18/google-analytics-event-tracking/
You need to add an onclick event to your links and provide a name for them, e.g.:
onClick="_gaq.push(['_trackEvent', 'Popular Posts', 'Clicked', 'Post Name']);"
Hope that helps
Related
Yesterday I got 200+ link clicks on the affiliate dashboard, it only shows around 30 clicks on analytics. I did the setup via tag manager for link click tracking and want to track affiliate link clicks as goals in analytics correctly.
The affiliate platform shows a lot more clicks and analytics is tracking only a few. I have three affiliate links in every post on the blog that I want to be tracked when someone clicks on them.
For e.g: https://www.spiritual-galaxy.com/angel-number-192/ , there are 3 affiliate links here, attaching the screenshots.
Screenshot - Affiliate Link 1
Screenshot - Affiliate Link 2
Screenshot - Affiliate Link 3
Attaching the screenshot for GTM settings.
Screenshot GTM
Attaching the screenshot for tracking event (affiliate link click) as a goal on analytics.
Screenshot - Track Event
GTMs click events can be challenging, and you get no data until it hits GA.
I would use the outbound clicks listener and manage rules inside of ListenLayer for what defines an affiliate link. It will then give you reporting on your click events directly so you will be able to see that compared to GTM.
Step 1: Create an account, get your script and place it on your website via GTM. Then turn on the Outbound Clicks Listener and it's Activity Features on the feature screen.
Step 2: Publish your changes and preview your website in GTM. Click on your affiliate links and you will see an outboundClick event pushed into the data layer for each click. . You can see here there are a ton of pieces of info that are really useful. Each row is a unique element of that click event and you can use them to customize your affiliate click data layer activity for better tracking.
Step 3: Let's identify your affiliate links via ListenLayer with some rules. The issue is that the Listener is going to capture all Outbound Clicks, and I'm assuming you might have some that are NOT affiliate links. You can also use the following process to categorize your affiliate links with a lookup table so you can actually segment which ones are receiving clicks!
Turn on the Custom Data Layer Feature under the Outbound Clicks Features screen. Then create a new data layer variable under Global Custom Data Layer Variables I'm creating one called affiliateClick. I am going to write some rules to push "yes" into this variable in my data layer whenever an affiliate link is clicked!
Step 3: Inside my Outbound Clicks Listener navigation, I will select Custom Values. Then create a Lookup Rule. We're going to use some values in our automatic data layer to determine if a click is an affiliate click. You can see in step 3 I would recommend just using a variable and selecting from this list.
For example, maybe you use hostname because you know all the website domains you will link to that are affiliate. Or you could add a URL parameter to all affiliate links and target that in the click event. I'm going to select Hostname. On the next step, select to define a value for the variable we created in step 2. Then click save and manage values.
Step 4: A table will be generate and you can insert rows. Each row is a rule, read top to bottom and it stops when a match is found. Here are my rules, your affiliate domain is at the top and I have some fake examples of others. You can see how you could also name or categorize these with this rule. At the bottom I have a catch all "no".
Save and publish your changes.
Step 5: Now your outbound clicks that are affiliate links will have this clear "Yes" value in the data layer
So instead of trying to use GTM to target some crazy xpath value, you can simply target event = outboundClick and clickCustomValues.affiliateClick= yes for a trigger that will universally capture your affiliate links. Now, if you wanted to you could get super fancy and categorize your affiliate links and pass them into GTM with a variable and pass that to GA with every event - all dynamically.
I'm sortof assuming you know GTM pretty well but basically you just need to be able to create Custom Event triggers based on the event name in the data layer outboundClick and capture data layer variables. If you need help with just reading and using data layer activity in GTM, there are probably a ton of details in other answers on stackoverflow.
So what I've been able to put together so far is that if you have the unique FBID to supply the following link with, you're able to get up to ~10,000 unique users who have "Liked" that page:
https://www.facebook.com/search/{Facebook ID}/likers?ref=about
Is there any way to append additional parameters to that link? Such as, people who like this page, and this other page {separate ID}? Or, people who like this page, and also lived in this city {city ID}?
The above link doesn't seem to "play nice" with other elements added into the Graph search, or maybe I'm not understanding how Graph functions. If I add things in to the search bar, it "kills" the page as a parameter. Facebook searching has become mysterious to me in the past couple of years.
I have a question, I want to add a new category in event tracking data in GA, I added the script ga.js, And in my js when I press on the button I do :
GA._trackEvent('Game','Play',value);
I looked in console network of browser, so the script have the state 200 OK,
the properties of this script :
utmac UA-1xxxx-1
utmcs UTF-8
utmdt Games
utme 5(Game*Play*Golf)
..............
The problem is that the category is not added in the google analytics. I look in the Audience>Cutom>Custom Variables. Can you help me please? What I'm doing wrong? Thx in advance
I think you are mixing a few things up here.
You have added code for event tracking
You are talking about checking custom variables (Audience>Cutom>Custom Variables)
You talk about categories.
Lets take them one at a time.
Event tracking:
Event Tracking is when a user clicks on a button this is an event you can track the button click in Google Analytics by adding the event tracking tag to the button click
<a onclick="_trackevent('button', 'click', 'linktohome');" href="http://www.home.com">home</a>
Google Analytics then should store a hit under behavior -> events -> overview
Custom varables
Custom variables are name-value pair tags that you can insert in your tracking code in order to refine Google Analytics tracking.
If I have a blog site and I have different authors on my blog site, I might create a custom variable for the author name so that I could track in Google Analytics who the author was for a blog post.
Custom variables must be set up in the Admin section of the Google Analytics website each variable has an index id.
_setCustomVar("1", "Author", "Jane Doe");
This tag is added at the top of the page along side your normal Google analytics snippet.
Custom variables can be seen (Audience>Cutom>Custom Variables)
Catagorie
Now Categories associated with the event can be seen at
behavior -> events -> overview
Update:
The signature of the _trackEvent() method is as follows:
_trackEvent(category, action, opt_label, opt_value, opt_noninteraction)
category (required) The name you supply for the group of objects you want to track.
action (required) A string that is uniquely paired with each category, and commonly used to define the type of user interaction for the web object.
opt_label (optional) An optional string to provide additional dimensions to the event data.
opt_value (optional) An integer that you can use to provide numerical data about the user event.
opt_noninteraction (optional) A boolean that when set to true, indicates that the event hit will not be used in bounce-rate calculation.
I'm just working on the tracking of woocommerce variable products with google analytics. Tracking simple products is not a big deal, because every page view is a product. However for me it's pretty interessing to know which product variations users looked at.
I need some similar stats for variable products. Which variable products did the users look at? My products do have quite some variations since one product has about 7 attributes.
I think it shouldn't be to hard to hook into the drop down selects of woocommerce variable products with js and fire on select.
How would you track the product variation views with google analytics?
I don't want to mix page views, sales and on the other hand view of product variations too much. I'd rather prefer to track the views of variations through events into a different view (or property). How you get those events into one view and everything else in the default view?
How would you track the parameters to be able to analyse them? My main filter will be product, than I want to filter on different attributes and see how the other attributes cluster on user impressions.
Anyone already has a script for this?
You can just add event handler for 'found_variation' in JS. That is woocommerce event for selecting variation.
And then use analytics built in function:
https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide
jQuery(document).ready(function($) {
$(this).on('found_variation', function(event, variation) {
_gaq.push(['_trackEvent', 'Variation', 'Select', variation.variation_id]);
});
});
Haven't tested it but in theory it should work.
And just check variable 'variation' to see what info is available.
I am using this Social Sharing tool called "Sharethis".
I gives you some header J.S. links to add to your HTML header.
Then, you'll need to add some SPAN in your code to add the social buttons, like this:
<span class='st_fblike_hcount' displayText='Facebook Like'></span>
Then, on load, you'll see your buttons to click on and get some social activity feedback.
Look at my page, if you have no idea how it looks like: http://www.seoroger.com/seo_quotes_archive.php
Problem is, I make dynamic pages like: /seo_quotes_archive.php?page=2, page=3, etc.
And this widget considers each of these pages a separate one (which is true somehow), and keeps each page's statistics separately.
I think the right thing to do for this instance, is to have one account for all of these pages and if the user clicks on facebook button on /seo_quotes_archive.php?page=5, for example, it increments the general facebook count.
If you agree, and you know how this is feasible, please help!
Thanks in advance!
PS. This case is the opposite of Multiple Sharethis buttons per page. In Fact, it's looking for a way to have one Sharethis statistics for Multiple pages.
You can add a "st_url" Parameter to specify the shared url. Insert the current url without the page-parameter to share the same url across multiple pages.
<span class='st_fblike_hcount' st_url='http://www.example.com/seo_quotes_archive.php' displayText='Facebook Like'></span>
Source: http://support.sharethis.com/customer/portal/articles/475079-share-properties-and-sharing-custom-information#sthash.EoamLhNZ.dpbs