Define the Rules, Create the Segment The last two rules can be the trickiest to implement

A collection of data related to the UK.
Post Reply
zihadhasan019
Posts: 12
Joined: Sun Dec 22, 2024 4:44 am

Define the Rules, Create the Segment The last two rules can be the trickiest to implement

Post by zihadhasan019 »

So we'll look at these first. Two insights help us solve these requirements: Insight 1: Combining the two rules, and using S and L to indicate short words (1 or 2 characters) and long words (3+ characters) we see that the only twenty possible structures for keyphrases are: L, LS, SL, LL, LSS, SLS, SSL, LLS, LSL, SLL, LSSS, SLSS, SSLS, SSSL, LLSS, LSLS, LSSL, SLLS, SLSL, SSLL Insight 2: The regular expression: \b[^ ]{3,50}\b matches a word of between 3 & 50 characters.


It's also necessary to know that ^ matches someth uk email address list ing at the beginning of an expression, and $ matches at the end. (Seriously, they do. Start by going through the examples at this site if you want to know why that's the case.) We're now in a position to take the list of combinations from 'Insight 1' and replace 'S' with \b[^ ]{1,2}\b (matching words with 1/2 characters) and 'L' with \b[^ ]{3,50}\b, putting spaces in-between, wrapping in parentheses, and matching at beginning and end.


Image


Missed that? OK, here are examples of some of the resulting statements: L becomes ^(\b[^ ]{3,50}\b)$ SL becomes ^(\b[^ ]{1,2}\b \b[^ ]{3,50}\b)$ LSL becomes ^(\b[^ ]{3,50}\b \b[^ ]{3,50}\b \b[^ ]{1,2}\b)$ etc. You should join the twenty created expressions together using a pipe character, to create the resulting, massive, expression. To save space, I won't post the whole expression in, but you can see what it looks like if you hover your mouse over this text. NB: There seems to be a limit to the number of parts to an expression that you can put into Google Analytics, so I tend to break this up into two parts - say, those matching on three or less words, and those matching four - and put them as 'OR' alternatives in one section.
Post Reply