Okay... this might be a long winded question but I'm sure it's a major issue that most wordpress site owners want to know about.
I've upgraded to Universal Analytics.
What I want to be able to do now is track traffic to my site according to the author of each post, the category of each post, and the tags that each post is tagged with.
In other words - show me data for all posts tagged "foo". In wordpress, all this information is already readily visible in meta tags on each page.
There is something called "Custom Dimensions" that seems to be designed for this. When you create a custom dimension in GA it gives you some code that looks like this:
var dimensionValue = 'SOME_DIMENSION_VALUE';
ga('set', 'dimension1', dimensionValue);
So...
Question #1 - Where does this code go? Google doesn't say! Is it supposed to go inside my existing GA code snippit? if so where?
Question #2 - Lets say I'm trying to track Authors. I'm guessing the code should look something like this:
var Author = 'Mr. Foo';
ga('set', 'dimension1', Author);
So the question is - how do I populate "Mr. Foo" with the actual author of the page? How do I tell Google to ignore this if there is no author (like if it's the front page?)
Question #3 - What happens when I try to track something like category or tag and a post might have dozens of tags?
Any help to solving this greatly appreciated! I've been on this for 2 days and have not found a single tutorial that even comes close. I swear I'll write one if someone can help me get this done...
Question #1: Place the code just before you call the 'send' command, like this
var Author = 'Mr. Foo';
ga('set', 'dimension1', Author);
ga('send', 'pageview');
You can also embed the Custom dimension in the pageview call as a parameter like this:
ga('send', 'pageview', {'dimension1': Author});
Question #2: You would need to use JavaScript to get the author data, check if it was not blank, and then to assign that value to your author variable. Do you have the author defined somewhere on the page identified with a CSS class or ID?
Question #3: Can you elaborate on this question and show what some likely examples and scenarios are?
Note that when using Custom Dimensions, you only have a total of 20 to work with (unless you are on Premium, in which case you have 200), so you will need to use them wisely.
Related
I'm sorry in advance if this has already been posted, I did a search and haven't found anything similar.
I hope that someone has an answer to this, as I've been trying to figure out how to do this, but without any success.
The issue is that I need to inject (somehow) a custom metric into the Product details before it gets sent to be able to override a metric value on Google Analytics.
Edit: When viewing Product details on Shopify and having set Google Analytics on the backend of the shop, it sends pageview and detail action with product details. Before that point happends, I want to inject "metric1":0 to that addProduct event. In the picture below, you can see where I need to add it.
console details
ga("ec:addProduct", {
id: "G175000BZ1TH6171",
name: "Black Mask with Activated Bamboo Charcoal",
category: "",
quantity: 1,
price: "5.36",
brand: "Development Store Tests",
variant: null,
currency: "USD",
metric1: 0 })
so I need to add "metric1":0 after "currency" in that object. As far as I found out, Shopify embeds the Google Analytics library via its own manager so anything that I add to product.liquid is called after that which is a problem. Is there any way to do this?
Any kind of help would be useful. Thank you for replying!
Shopify takes the template like product.liquid (plus sections & includes) and turns that into an HTML string that gets sent to the browser. So if you know what you are doing, there is nothing stopping you from injecting whatever you want into the product details. You are free as a bird to convert yin to yang and back before the output goes to the browser. Since no analytics operate at that stage, you are safe there. So do your magic.
I am trying to figure out how to add tracking with Google Analytics to multiple phone numbers on a Wordpress site. I saw this page from and earlier Stack Overflow post but I wasn't sure if it was up to date. I noticed somewhere else (here) on a Google search that said you have to add an Event in your GA account first and then add that code. Is this correct? Or do you just have to add the code itself to the Wordpress site without adding an Event in GA?
Also, if it's code for a link, can I highlight the phone number and put the code into the link area (as in chain link in the Visual Editor) on the page, or do I have to place this code in the Text Editor part of the page?
I'm using the current UA right now.
Also, I'm really new to this event tracking stuff, so please accept my apologies if I stated/asked anything incorrectly. Thanks in advance for any and all feedback.
Add a class to all your phone number instances within your HTML. ie class="tel">
Write a click function on that class, and then push the ga following the correct version syntax.
ga('send', 'event', 'category', 'action');
So:
$('.tel').click(function() {
ga('send', 'event', 'Category1', 'Action1', 'Demo!');
});
Use Google Tag Manager. It's great tool. There is also a plugin: DuracellTomi's Google Tag Manager for WordPress. You must read some documentation about GTM but when you will know GTM you can track almost anything on your site.
I have a set of tags on all of my article pages which I'd like to track. Ideally I want to see how many page visitors etc each tag gets. I want to be able to track pages that are tagged with beer and cheese and any other tags that it may find within the tag-group class.
<div class="tag-group">
<p>
beer
</p>
<p>
cheese
</p>
</div>
Is this possible with Google Analytics? And if so, how? I've tried pokeing around the interface but I haven't been able to find a way to setup some sort of specific tracking targetting.
I don't see a perfect way to do this because you cant store multiple layer on Google Analytics, so in almost all the cases you need to store all the tags in a single array. (You can unse a custom dimention isBeer for example, but this can be not the proper way)
But this 2 options might help you on this
Content grouping : this allows you to group the content by writer, editor, tags, etc. But in this case you have to manage to see how you group the content. i don't see much future in this way but here is an option
https://support.google.com/analytics/answer/2853423?hl=en
Use Custom Dimentions: This is the easiest one, you can add all the tags in a single string inside the custom dimention, and them look for it on the plataform segmenting or using it as a second dimention (on the report ).
https://support.google.com/analytics/answer/2709828?hl=en
the code on the pageview need to be modified to add this information:
ga('create', 'UA-XXXX-Y', 'auto');
ga('set', 'dimension1', 'Level 1');
ga('send', 'pageview');
This is more and less an option for you?
I think the title is pretty self explanatory. But here's the longer version:
Basically I have a site with permalinks that do not include the category they're in. Posts can only be in one category. So what I want to do is track page views and group them in Google Analytics by post category. How can I do this? I've approached the problem from a Page View and Event tracking point of view but with little joy.
Thanks in advance for help
Carl
For data already collected you are out of luck. For incoming data you can create content groupings. Since your url do not contain a category you'd have to set the content group via code like this:
ga('set', 'contentGroup1', 'WP category');
How you would do this in WP depends a lot on how your GA code is inserted in the page (I think there are GA plugins that allow you to set the category as content group).
I googled and googled try to find something relevant but no luck.
I'm setting up a 'daily tips' campaign for a client and I have to use RSS to do it.
In more detail I use MailChimp and I create a RSS-Driven campaign.
On the other side in the blog of the website there are daily scheduled posts.
I'm trying to find a way to only get the first paragraph of the each post to give it to MailChimp and include it in the email.
So that the structure ends up like this:
Post title
Post's first paragraph
Read more link
Any ideas?
I don't think this is possible within Mailchimp directly, but you you might try FeedsAPI if you have a specific feed, even perfect if it's a not so popular feed since they can create specific extraction patterns for cases like this, it's however a paid service.