Google analytics filter out file extension - regex

I am noticing a few variations of the same page in my google analytics reportings e.g.
/flash.php
/flash/
/flash
Does anyone know a (safe - won't mess up any data) filter to consolidate all urls into the /flash format (remove the extension and any trailling slashes)?
Much appreciated.

To merge these URLs into one, the solution is to use a Search & Replace Filter, or an Advanced Filter, depending on your usage for it.
For the case of only one page with this matter, the solution is to use the S&R filter:
1 - Go to your filters page, inside de profile you wish to apply the filter to
2 - Create a New Filter and select Custom Filter as the Filter Type
3 - Select Search and Replace
4 - Select Request URI as the Filter Field
5 - Type \/flash.* as the search string
6 - Type /flash as the replace string
Done, every URL that contains more than /flash will be merged into this one /flash one.
You can learn more about the search and replace filter here
For the case of many pages with this matter, the solution is to use the Adv filter:
1 - Go to your filters page, inside de profile you wish to apply the filter to
2 - Create a New Filter and select Custom Filter as the Filter Type
3 - Select Advanced
4 - Select Request URI as the Filter Field A
5 - Type ^(\/[\w\-]*)|^(\/)$ as the Extract A
6 - Select Request URI as the Output
7 - Type $A1$A2 as the Constructor
Augusto Roselli - Web Analytist at dp6

Related

Oracle APEX - how to read a cell from interactive grid

The same question once again but with (I hope) better explanation:
I created the most simple case:
An Interactive Grid IG with data source EMP ( table with 14 records contains Ename, Job, HireDate, Salary etc. etc.)
Text field P7_ENAME
After running it looks like below:
What I would like to do is to copy Ename from selected record of IG to P7_ENAME field .
I found several tutorials (text and video) how to do it. Most of them suggest to create dynamic action SelectionChange on IG and when TRUE add a JavaScript code something like below:
var v_ename;
model = this.data.model;
v_ename = model.getValue( this.data.selectedRecords[0], "Ename");
apex.item( "P7_ENAME" ).setValue (v_ename);
and the second step is to create another action: Refresh.
So finally I have a dynamic action with two steps : the first one is a Java script code and the second refresh function on my P7_ENAME field.
Sounds simple and it is simple to repeat/implement. A guy (I suppose) from India published a video on YouTube (https://www.youtube.com/watch?v=XuFz885Yndw) which I followed and in his case it works good. In my case it simple does not work - field P7ENAME is always empty, no errors appears. Any idea why ? Any hints, suggestion ?
thanks for any help
K.
The best way to debug and achieve what you are trying to do is as follows:
create the Dynamic action with the following setup:
-when -> selection change[interactive grid],
-selection type -> region, region -> your IG region,
-client side condition -> javascript expression: ```this.data.selectedRecords[0] != undefined```
First action of the true of the DA with the type: execute javascript code and fire on initialization is turned on, code: console.log(this.data.selectedRecords);
Run your page, and check the browser console. You should see an array of columns when you select a record from that IG as follows:
Find in that array, which sort number of the array contains the data that you want to use for the page item. Let's say I want the 3rd element which is "2694" then I should change my dynamic action's execute javascript code to:
var value = this.data.selectedRecords[0][2];
apex.item( "P7_ENAME" ).setValue (value);
The last thing I should do is add another true action (and the refresh action at the end) to the same dynamic action with type 'SET VALUE' and 'PLSQL EXPRESSION' as type, put :P7_ENAME in the expression, items to submit P7_ENAME and affected element: item / P7_ENAME as follows:

How to search a string in an Oracle Apex page having multiple reports?

Suppose there are 3 Reports in an Oracle Apex page and I want to search all the columns of all the reports to get the matched string that the user will search. Any ideas?
Create your own search item; let's call it P1_SEARCH. Modify all reports' queries and add condition into their WHERE clauses, e.g.
select ...
from ...
where ...
-- add this:
and ( (column_1 = :P1_SEARCH or
column_2 = :P1_SEARCH or
...
)
or :P1_SEARCH is null
)
Columns you'd use should make sense (i.e. there's no use in searching DATE datatype columns for "Ashi", is there?).
Looking at what you should do (using that suggestion, of course), I'd say that it is simpler to use Apex engine and search 3 times, report-by-report.

String matching in URL using Hive / Spark SQL

I have two tables, one containing list of URL and other having a list of words. My requirement is to filter out the URLs containing the words.
For eg:
URL
https://www.techhive.com/article/3409153/65-inch-oled-4k-tv-from-lg-at-a-1300-dollar-discount.html
https://www.techradar.com/in/news/lg-c9-oled-65-inch-4ktv-price-drop
https://www.t3.com/news/cheap-oled-tv-deals-currys-august
https://indianexpress.com/article/technology/gadgets/lg-bets-big-on-oled-tvs-in-india-to-roll-out-rollable-tv-by-year-end-5823635/
https://www.sony.co.in/electronics/televisions/a1-series
https://www.amazon.in/Sony-138-8-inches-Bravia-KD-55A8F/dp/B07BWKVBYW
https://www.91mobiles.com/list-of-tvs/sony-oled-tv
Words
Sony
Samsung
Deal
Bravia
Now I want to filter any URL that has any of the words. Normally i would do a
Select url from url_table where url not like '%Sony%' or url not like '%Samsung%' or url not like '%Deal%' or not like '%Bravia%';
But that's a cumbersome and not scalable way to do it. What is the best way to achieve this? How do I use a not like function to the words table?
Using regex:
where url not rlike '(?i)Sony|Samsung|Deal|Bravia'
(?i) means case insesitive.
And now let's build the same regexp from the table with words.
You can aggregate list of words from the table and pass it to the rlike. See this example:
with
initial_data as (--replace with your table
select stack(7,
'https://www.techhive.com/article/3409153/65-inch-oled-4k-tv-from-lg-at-a-1300-dollar-discount.html',
'https://www.techradar.com/in/news/lg-c9-oled-65-inch-4ktv-price-drop',
'https://www.t3.com/news/cheap-oled-tv-deals-currys-august',
'https://indianexpress.com/article/technology/gadgets/lg-bets-big-on-oled-tvs-in-india-to-roll-out-rollable-tv-by-year-end-5823635/',
'https://www.sony.co.in/electronics/televisions/a1-series',
'https://www.amazon.in/Sony-138-8-inches-Bravia-KD-55A8F/dp/B07BWKVBYW',
'https://www.91mobiles.com/list-of-tvs/sony-oled-tv'
) as url ) ,
words as (-- replace with your words table
select stack (4, 'Sony','Samsung','Deal','Bravia') as word
),
sub as (--aggregate list of words for rlike
select concat('''','(?i)',concat_ws('|',collect_set(word)),'''') words_regex from words
)
select s.url
from initial_data s cross join sub --cross join with words_regex
where url not rlike sub.words_regex --rlike works fine
Result:
OK
url
https://www.techhive.com/article/3409153/65-inch-oled-4k-tv-from-lg-at-a-1300-dollar-discount.html
https://www.techradar.com/in/news/lg-c9-oled-65-inch-4ktv-price-drop
https://indianexpress.com/article/technology/gadgets/lg-bets-big-on-oled-tvs-in-india-to-roll-out-rollable-tv-by-year-end-5823635/
Time taken: 10.145 seconds, Fetched: 3 row(s)
Also you can calculate sub subquery separately and pass it's result as a variable instead of cross join in my example. Hope you got the idea.

InfluxDB Grafana templates: Can't select all fields in "Add Query"

I believe I've done everything right when creating my graphite DB. Grafana can see the data but won't let me select all the fields when I try to "Add Query".
Output from my server shows that the DB is working:
show measurements
name: measurements
name
PORT
select * from "PORT"
name: PORT
time CardNo Counter Nodename PortNo value
---- ------ ------- -------- ------ -----
1511214407000000000 18 bcast_inpackets ALPRGAGQPN2 1 500
However, when I try to "Add Query" in Grafana, I can see PORT in "FROM" (which is what I want), but in the "WHERE" section, when I try to narrow my selection using CardNo, Counter, etc., it appears to behave randomly. If I select CardNo first, it will let me select 18 (see picture below), but then clicking "+" to add another criteria doesn't display the option for say "PortNo" (all I get is an empty dialog box). I can enter the field value manually (eg PortNo) but other users will be plotting graphs and won't necessarily know the underlying schema. Also, if I select Nodename first, then I can select CardNo (weird). I'd like it so the end user can specify ALL the fields (in this case CardNo, Counter, Nodename and PortNo).
My graphite template is this:
"[[graphite]]
# Determines whether the graphite endpoint is enabled.
enabled = true
database = "graphite"
# retention-policy = ""
bind-address = ":2003"
protocol = "tcp"
# consistency-level = "one"
templates = [ "ASR.PORT.* .measurement.Nodename.CardNo.PortNo.Counter"
]
and the data I feed to InfluxDB to test my setup is:
echo "ASR.PORT.ALPRGAGQPN2.18.1.bcast_inpackets 500 `date +%s`" | nc localhost 2003
Firstly, template is better written as:
"ASR.PORT.* .measurement.Nodename.CardNo.PortNo.field"
Which makes bcast_inpackets and any other value after PortNo into a field containing data. This reduces cardinality of series, which improves performance and scalability, by combining all counters into multiple fields on the same series as opposed to separate series with unique tags with their own value fields.
Grafana's influx query builder will filter tag values for the value of the already selected tags. In other words, if you select PortNo=1 and try to select another tag, only tag keys where PortNo=1 will be shown.
If you look at queries Grafana runs in browser, you will see something like show tag keys from PORT where PortNo='1' if PortNo=1 is already selected and different queries for other tags.
This is why you may not see other tags and why which tags you see depends on the tags already selected. This is by design so if you want something different you will need to adjust the schema by, for example, making PortNo and CardNo into fields instead of tags.
You might also be interested in InfluxGraph which can query InfluxDB via Graphite API and also supports same template configuration as InfluxDB.

Filter out RSS items with description less than 3 characters using Yahoo Pipes

I am trying to filter out items that has empty description or description shorter than 3 characters using this Yahoo Pipe:
http://pipes.yahoo.com/pipes/pipe.edit?_id=966d5a5006cad6b2825d4f744b1ebb50#eefd469cf1c28d4d6cb6bd6c6c1ab6b8
Here is the workflow of the Pipe:
"Fetch Feed" module - fetch the feeds
"Create RSS" module - create new Feed and use item description as item title for new feed
"Regex" module – remove html tags from title
"Filter" module – I want to block items that have either empty descriptions or descriptions shorter than 3 characters, I am not sure what to put there – "null", "*"…?
Try changing your filter to permit items that match rather than block, and change your regex to the following:
^.{3,}$