Google analytics and dynamic pages - google-analytics

I have a (Symfony based) website. I would LIKE to analyize the site traffic using Google Analytics. My site is divided into several (i.e. N) categories, each of which may have 0 to M sub categories.
Schematically, the taxonomy of the site breaks down into something like this:
N major categories
Each major category may have 0 to M sub categories
further nesting is possible, but I have just kept it simple for the purpose of illustration.
I need to know which sections of the website are genererating more traffic, so that I can concentrate my efforts on those sections. My question is:
Is there anyway to identify the data that is being generated from the different sections of my site?.
Put another way, is there a code or 'tag' that I can generate dynamically (in each page that is being monitored) and pass to GA, so that I can identify which section of the website the traffic came from?
The documentation I found on google about this topic was not very useful (atleast it did not answer this question).

You can pass a uri to _trackPageview that would permit you to log the request in whatever format you'd like, including however your user's requesting the page.
Remove/replace the original call to pageTracker._trackPageview with the following:
pageTracker._trackPageview('/topcategory/subcategory');
You'd just need to plug in the topcategory and subcategory info. If the info is available in the URL you could parse it out using js on the fly.

Related

What is the proper way to tag pages in Google Analytics?

I don't even know if "tagging pages" is what I mean.
Essentially, I have a large education website with many types of pages. Specifically, I want to tag our program pages by faculty, level, etc. For example, the Biology program page would be tagged with Science (as its faculty), and Undergraduate (as its level). It's possible that a program could belong to multiple faculties and/or levels (Psychology, for instance, is both a Science program and an Arts program). There is nothing in the URL to signify faculty or level. The website is built in Drupal, in case you know of any modules that could facilitate this.
I want to understand how different faculties/levels/etc perform. I will be building reports in Google Data Studio.
Any guidance would be appreciated!
What you are looking for is called 'content grouping'. If you haven't information in the URL you can define some rules when the page loads and pass the information to Analytics with the pageviews.
You can find more information here:
https://support.google.com/analytics/answer/2853423?hl=en
Then you can get these information from Data Studio.
Because of your multi-value needs, nothing in GA is going to satisfy your requirements out of the box. You will have to do some post-processing, and I am not familiar enough with Data Studio to know where its limits are in that regard.
As the previous poster suggested, Content Grouping is the standard way to create custom aggregations of pages. You can have multiple content groupings, such as Faculty and Level, but a page can be in only one group per grouping (not the clearest terminology but it appears to be what Google uses).
A different option is Custom Dimensions. There are two options here. One is to create custom dimensions for Level and Faculty. Each page can still have only one value per dimension, but you could send a comma-delimited string when a department is in multiple faculties (for instance) and then pull it apart again in a spreadsheet.
The second option is to create a custom dimension for Department directly, and associate each department to the appropriate one or more faculties and levels in your reporting.
How you set the custom dimensions or content grouping will depend on your implementation of GA. If you are using the Google Analytics Drupal module, it says it supports setting custom dimensions as a feature. If you are using Google Tag Manager you can set the dimension value in your tags directly, though of course it will need to decide what value to set on based on either totally enumerated rules you write or something it can read out of the page. Here is some Tag Manager documentation: Content Grouping via GTM; Custom Dimensions via GTM.
If the department is present in the page in some consistently marked-up way you can grab it; if not the Metatag module or one of its schema.org extensions might be able to provide you a spot to set a value for GTM to retrieve.

WordPress custom query-string not index by Google

I have a WordPress site (www.AgingSafely.com) and on it I have built a plugin to show the “Details” about various Adult Family Homes (AFHs). All of the details are retrieved out of database table via a query-string (?asi_id=WA_Af_nnnnn) where the n’s are the AFH’s license number. I have created a “Site Map” page (https://www.agingsafely.com/asi-site-map/) that lists an overview and has links to the Details Page for each AFH, so that Google can find and link them. They are also listed in sitemap.xml.
Google isn’t indexing them, but is indexing the more normal pages on my site.
I figure that I need to change my URLs from https://www.agingsafely.com/adult-family-home/?asi_id=WA_Af_751252 to something like https://www.agingsafely.com/adult-family-home/AFH/751252 to make Google happy. To add a little more complication, The “Af” in the query string is for “Adult Family Home”. The plugin also handles “Boarding Homes” “Bf” and “Nursing Facilities” “Nf”.
How do I get the URL with the ?asi_id=WA_Af_751252 rewritten to AFH/75152
This appears to two parts: Change the links in the plugins to the /AFH/nnnn format which should be easy. Have some re-write rule that converts the new URL format back to a query string.
What is the best way to do this?
Does Google ignore query strings?
Are you planning on a lot of people entering in that particular string in a google search? Possibly some will, but probably not. If you want people to be able to easily find your products/homes via google searches, yes I would change the links to something like https://www.agingsafely.com/adult-family-home/AFH/751252. Literally spell out as much as you can, unless a string is a popular part number that people search for or something like that.
Also, is your site integrated with google analytics and google search console? I would definitely do that if you haven't.

Inherit URL path on Google Analytics Experiments

I want to run an A/B test using Google Analytics Content Experiments to test different pages.
I would like to know if there is a way to define variations inheriting parts of the URL path. I read the documentation but seems that Analytics only inherits URL dynamic parameters.
My URLs look like:
https://example.com/page1/{USER-DATA-123}
where {USER-DATA-123} contains some data related to current user and it's different for every visitor.
And I want to create this experiment:
Original page: https://example.com/page1/{USER-DATA-123}
Variation page 1: https://example.com/page2/{USER-DATA-123}
I was investigaing the same issue, just had to test two desings of this page https://labiteam.com/services/landing-page. There are two variants:
Turn your static urls with id sessions into dynamic. According to this manual https://support.google.com/analytics/answer/2664470?hl=en it should work
You can customize testing script manually, though I doubt it's a practical decision
Upd: Also, one more suggestion. Forget about A/B experiments, just make your URLs appear randomly (coding it manually) and set goals to each url.

Can I filter a Google Analytics segment based on content grouping pageview count?

I want to create a Google Analytics segment for our users who view at least a certain number of pages on our site. From what I can tell (please correct me if I'm wrong) this is easy to do if you don't care about what kind of page they view: you create a filter for the segment that checks to see if Unique Pageviews is greater than some value such as 4. However our site has a whole bunch of pages that I don't really care if someone reads (our "about page" for example). So what I'm trying to do is create a segment of how many people view at least X pages of what we call "Learning Content" (basically two specific page types on our site). How can I segment the users who read a certain amount of learning content?
Two types of pages fit into our definition of learning content. The first one has a URL matching a regex that sort of looks like /learning_content_1/.* and the second matches regex /learning_content_2/.*. I've already created a content group for learning content that correctly identifies these two content groups. However I wasn't able to find any way to filter a segment based on how many unique pageviews (or even just pageviews) come from a specific content grouping. Is this even possible? If not, how might I work around that?
The research I've done so far: Google Analytics: How to segment by many groups of pages was somewhat helpful but didn't address the question of how to create an actual GA segment based on pageview information for a content grouping or content group.
The only way I can think of handling this, is by associating a specific custom event that gets triggered on this page. Then you can create a segment that matches users who have that event category:
and total events greater than 4:
It's a workaround, and it doesn't work if you are tracking other events, but maybe that works for you?

Analytics Experiments Dynamic URLs

I have a lot of product pages like this:
www.example.com/catalog001/item123
www.example.com/catalog002/item321
www.example.com/catalog002/item567
Every catalog and product(item) have its own numeric id.
Product pages are similar. Just different product image, price, title.
I tried to use Regular Expressions to set up original url pattern in Analytics Experiments:
www.example.com/catalog(\d+)?/item(\d+)?
Is there any way to set up original url pattern?
I'm not quite sure what you're asking. It sounds like you want to test many different product pages without setting up many different experiments, presumably to test two different product page layouts.
If so you can use relative urls in the experiments interface for that, there is no need for regular expressions. Create an experiment for one product page, select relative urls for the variations, enter a query string (?foo=bar) or fragment identifier (#foo=bar) that triggers the variation page, add experiment code to all the originals and the test will be enabled for all your product pages, not just the one url you entered in the interface.
If you were after something else I suggest you re-word the question to explain the actual problem rather than your attempt to solve it.

Resources