Combining similar URLs in Google Analytics (with a twist) - google-analytics

I have a lot of similar URLs that I would like to merge in Google Analytics. I've managed to merge a lot of them already. However I've now run into a bit of a problem.
I have URLs that look something like this;
article/4567/edit
article/87478548/edit
article/82984786/add
article/8374/add
How would I go about merging these URLs so that they display as;
article/edit
article/add
Any help is greatly appreciated.
EDIT: I also need to be able to have GA display every article in one line on the table called "article/" regardless of any ID that is after it. I don't want the table to look like:
article/12342 1,000 views
article/7465890 900 views
I need it to display as:
article/ 1,900 views

You can create an Advanced filter that combines the relevant parts for you:
The output would be /article/edit or /article/add, with everything and anything between those removed.
EDIT:
If you just want everything, regardless of /edit, /add, /12341/edit, /7305/add, /whatever/edit, to show up just as /article, then you can just change your filter like this:
Field A: Request URI = (/article)/.*
Output to: Request URI = $A1
This will convert the following examples:
/article/123/edit -> /article
/article/2345/add -> /article
/article/anything -> /article

From this Combining similar URLs in Google Analytics you can find out how to do it. You need to use a regex. Something like this should work (did not test it).
(article\/)[0-9]*\/(edit|add)

Related

Nested Shortcodes?

For my WordPress site, I am using both PODS, and WPDataTables to manage my data. With that, I am using WPDT's "placeholder" feature to create dynamic SQL queries that will display different data depending on what user is logged in. Currently, I can ALMOST do everything I need, but not quite. This is more or less what I would like to achieve (var1 = the output of another shortcode):
[wpdatatable id=14 var1=
[pods name="User" template="Company" where="id = {#user.id}"][/pod]]
[/wpdatatable]
This shortcode is working, and will pull back a single number, based on the user that is logged in:
Company: [pods name="User" template="Company" where="id = {#user.id}"]
And this code is working if I hardcode a specific value to var1:
[wpdatatable id=14 var1=5]
Basically, I have two separate shortcodes that work individually, but will not work when put together. I was wondering if something like this would be possible? Or if I needed to maybe think of a new approach. Thanks in advance!
Side Note: I have tried using the "Outerbridge Nested Shortcodes" plug-in without any luck. After talking with the plug-in author, I discovered that this plugin only works for:
[tag-a] [tag-b] [/tag-a]
And not:
[tag-a [tag-b] ]
That's something wpdatatable needs to enable like we do it for pods but that would be around the other way see how it's done for pods: https://pods.io/docs/build/using-shortcodes-pods-templates/

Track subdomains and query parameters within Google Analytics

We have GA on a site that has hundreds of subdomains and each subdomain can have query parameters attached. I have a filter set up to show full domain and it's as follows...
Now, when I go to Behavior -> Site Content -> All Pages I see all the subdomain pages that were visted
john.male.personfinder.com
stacy.female.personfinder.com
mark.male.personfinder.com
sue.male.personfinder.com
What's not being "tracked" (probably the wrong term), is the query parameters that COULD follow the above urls.
john.male.personfinder.com
john.male.personfinder.com?state=ca
john.male.personfinder.com?state=ca&city=sf
Do I need to set up another filter to track these query parameters? Google Analytics is like a foreign language to me, so any walkthroughs and explanations would be GREATLY appreciated. Searching the web gave me mixed answers that didn't quiet match what I was looking for.
Thanks!
I think you will need to populate a custom dimension from your site, to get the parameter information.
Here's a snippet from my use of something similar:
$scoreid = $_GET["scoreid"];
...
<a name="metadata" id="metadata" data-scoreid="<?php echo $scoreid; ?>"></a>
I then use the data-scoreid DOM element to populate a custom GA dimension (in my case via a Google Tag Manager variable).

Getting the right data from webpage

I am looking to extract some data from website:
http://www.delfi.lv/bizness/biznesa_vide/tirgus-liberalizacija-ka-latvija-nonaca-krievijas-gazes-juga.d?id=44233361&com=1&s=5
from me it's valuable to get info like:
"<h3 class="ca56269332 comment-noavatar listh3 comment-noavatar-author">
vārds
</h3>"
In this example "ca56269332" and "vārds" are dynamic variables.
For me I want to achieve something like this:
"<h3 class="* comment-noavatar listh3 comment-noavatar-author">
*
</h3>"
where "*" means a dynamic value, and export in some kind of excel or data file.
Also I want to extract multiple pages, like:
/tirgus-liberalizacija-ka-latvija-nonaca-krievijas-gazes-juga.d?id=44233361&com=1&s=5&no=0
/tirgus-liberalizacija-ka-latvija-nonaca-krievijas-gazes-juga.d?id=44233361&com=1&s=5&no=20
/tirgus-liberalizacija-ka-latvija-nonaca-krievijas-gazes-juga.d?id=44233361&com=1&s=5&no=40
ect.
Can anyone please share some valuable resources to achieve that, I know that you can make it with PHP file_get but I want easier solution because my goal is not to publish it to webpage but use as source for my study project as a data file.
How to EXTRACT dynamic data to AVOID saving EVERY page with ALL the useless information it contains and make it easier, avoiding to manually process large number of web comments?

ExpressionEngine conditional based on Google Analytics URL tags

I am trying to create a conditional statement in ExpressionEngine that displays content based on the utm_source variable in a URL with Google Analytics campaign information.
If, for example, the url is
"www.mysite.com/landingpage/?utm_source=One" some content would be displayed
and if the url is
"www.mysite.com/landingpage/?utm_source=Two" some other content would be displayed.
To get started, I tried:
{if segment_3 == "?utm_source=One" }
Do something special
{/if}
But ExpressionEngine does not appear to recognize the URL tag info as a 3rd segment. Any ideas as to how I might approach this?
Thanks,
-Michael
One I found out about today: Mo Variables
Then your code would look like this:
{if "{get:utm_source}" == "One"}
Do something special
{if:elseif "{get:utm_source}" == "Two"}
Do something extra special
{if:else}
Do something boring
{/if}
There are others like this one that I've used before but just does what it says on the tin. Whereas Mo Variables does a whole lot more.

How to OR solr term facets via the search URL in Drupal 7 site?

I have a Drupal 7 website that is running apachesolr search and is using faceting through the facetapi module.
When I use the facets to narrow my searches, everything works perfectly and I can see the filters being added to the search URL, so I can copy them as links (ready-made narrowed searches) elsewhere on the site.
Here is an example of how the apachesolr URL looks after I select several facets/filters:
search_url/search_keyword?f[0]=im_field_tag_term1%3A1&f[1]=im_field_tag_term2%3A100
Where the 'search_keyword' portion is the text I'm searching for and the '%3A' is just the url encoded ':' (colon).
Knowing this format, I can create any number of ready-made searches by creating the correct format for the URL. Perfect!
However, these filters are always ANDed, the same way they are when using the facet interface. Does anyone know if there is a syntax I can use, specifically in the search URL, to OR my filters/facets? Meaning, to make it such that the result is all entries that contains EITHER of the two filters?
Thanks in advance for any help or pointers in the right direction!
New edit:
I do know how to OR terms within the same vocabulary through the URL, I'm just wondering how to do it for terms in different vocabularies. ;-)
You can write a filter query that looks like:
fq=field1:value1 OR field2:value2
Alternatively you can use localparams to specify the query operator:
fq={!q.op=OR}field1:value1 field2:value2
As far as I know, there's not any easier way to do this. There is, in fact, an rather old bug asking for a way to OR the fq parameters...
I finally found a way to do this in Drupal
Enable the fq parameter setting.
Go to admin/config/search/apachesolr/[your_search_page]/core_search/edit or just navigate to the settings of the search page you're trying to modify
Check the 'Allow user input using the URL' setting
URL Syntax
Add the following at the end of the URL: ?fq=tid:(16 OR 38), where 16 and 38 are the term ids

Resources