How to write a Google Analytics filter to record site searches - filter

I what to record all my website searches with google analytics but the problem is my search links look like this
**www.mywebsite.com/search/category/your+query+here**
From what i found out i must give GA the query parameter (mywebsite.com/search.php?q=your+query+here) but i have none (and don't want any).
Is there a way to rewrite the URL with a google analytics filter? If yes how.

Yes, you can create a custom filter that rewrites URL /search/<category>/<query> to ?q=<query>&c=<category>.
Go to Analytics Settings › Filter Manager, and click Add Filter. Choose Custom Filter in the Filter Type drop-down list, select Search and Replace radio button, and then set two Request URI fields with the corresponding values. For further details, see ’How do I create a filter?’ page in Google Analytics Help Center.
Keep in mind! Since past visitor data cannot be reprocessed, always keep a ’raw’ profile that you do not apply filters against. For further details, see chapter ’Best Practices for Filters & Profiles’ in presentation ’Filters in Google Analytics’.

Site Search is processed BEFORE Filters are applied.
I went through a week of testing to realize this. Yes, the Filter logic is correct, but as of Nov 1, 2009 this will not work with Site Search.
We accomplished this by appeding the ?search= parameter to the page URI in the GA script. Then we strip search params in the Profile Settings and we get the pure URI's in the content section as well as the Searches tracked in Site Search.

I know this is old, but to expand on the prev accepted answer, use a 'virtual url' in the _trackPageview call, so for www.mywebsite.com/search/category/your+query+here have
gat._trackPageview( "/search/content/your+query+here?query=your+query+here&cat=category" )
This means that URLs won't be changed, so everything else works (as noted in the previous answer) - if you really want to you could remove the search params, but unless you're running into a URL limit I'd probably prefer to keep them present so they can be seen in the content reports.

Related

Set a Kibana dashboard filter through the url

I created a Kibana dashboard, containing some visualization. I can successfully embed the dashboard using the provided url:
{url}/app/kibana#/dashboard/{dashboard_uuid}?embed=true&_g=(refreshInterval:(display:Off,pause:!f,value:0),time:(from:now-1y,mode:quick,to:now))
Now, I would like to have any user of my app to see this dashboard, filtered in order to only see their data. The filter query that I need is very simple, because all the data contains a field user_id.
An example: For the user with identifier $id, I want to load the dashboard with the filter user_id:$id
In there a way to set the filter through the url? I see there are some parameters already (refreshInterval, time..) but I couldn't find the proper documentation. Any ideas?
Using Kibana 6.2.2 and ElasticSearch 6.6.0
I tried setting the filters through the _a parameter, as explained here: https://discuss.elastic.co/t/dashboard-search-parameter-via-url/84385 without success.
{url}/app/kibana#/dashboard/{dashboard_uuid}?
embed=true&
_g=(refreshInterval:(display:Off,pause:!f,value:0),time:(from:now-1y,mode:quick,to:now))&
_a=(filters:!(),query:(querystring:(query: "user_id:1")))
I stumbled upon this while looking for a solution to a slightly similar question. I figured I would share two options that I have gotten to [mostly] work, but either should do what you are looking for.
URL With Variable Set to Application State:
../app/dashboards#/view/{dashboard_uuid}?_a=(filters:!((query:(match_phrase:(user_id:$id)))))
Using this method, the filter is not "pinned", so if you have another link on your landing dashboard, the filter will not remain if you click that link. However, your other global state settings (timeframe, etc.) do remain.
URL With Variable Set to Global State:
../app/dashboards#/view/{dashboard_uuid}?_g=(filters:!((query:(match_phrase:(user_id:$id)))))
Using this method, the filter is "pinned" and remains throughout additional clicks. However, this URL will overwrite all your other global state settings (timeframe, etc.).
This is where I am. I would like the filter to remain pinned, but if I have a time filter set as well, clicking this link will unfortunately default to the timepicker:timeDefaults setting in Kibana.
I still have not found a solution to my issue, but I hope this answers the original question; or perhaps help someone else that stumbles here (seeing as how this thread is very old now).

performance testing on google maps

Our client has implemented google maps on which user can select particular location from the map which can be added by the user and perform the next action of it. How should i test the dynamic value appearing from the google maps for a particular search criteria ..
for example here is the scenario
you search a location--> get the desired result go to google map--> click on the add button of that location and proceed futhur.
How should i design my testplan/scripts for the same.
I cannot go for correlation also because the value of data is not define in the previous sample using regular expression.I want to change the data dynamically in the same sampler.
Thanks :) :) :)

Goal not working with pagePath filter in Analytics API

I would like to find the conversion rates for one of my goals. However, I just want to see the results based on pages with "profile/" in the URL. I've tried using the following filter separately in the Analytics API add-on for Google sheets: ga:pagePath=#profile/ or ga:pagePath=~profile
The filter works, but I don't get any conversion hits. Can anyone help?
Thanks,
Josh
Unless your goal actually is the page with the path of /profile you should use a segment rather than a filter. The difference is that a segment will give you the visits that include (exclude etc. depending on the conditions for you segment) visitors via the profile page, whereas a filter will only include pageviews to the exact /profile page.
So you are looking for a segment definition like
sessions::condition::ga:pagePath==/profile
This will limit the data to sessions that have at some point visited the profile page (but will also show what happenend before and after).
A more convinient way to get your segment definition is to define the segment in the GA interface, then head over to the query explorer and select your newly created segment via the segments dropdown. You can copy it from there (either by id or you can copy the segment definition if you click the checkbox below the dropdown).

How do I restriction a Google Places Search to a specific country?

The documentation says how I can limit searches to a country by using componentRestrictions. However, the documentation apparently only relates
to JavaScript.
I'm doing a regular request from a PHP application, and need to limit a place
search to a country. However, I can't see how I can limit search results to a country using a regular GET request.
I believe you can just add components=country:XX to your request URL :)

Google is indexing future dates on my codeigniter datepicker

If I do a google search for "harbour holidays 2 strand" then it returns my clients site www.padstow-self-catering.co.uk
The problem is that google has decided to index and future date which can be seen from the datapicker on the right sidebar. Nearly all searches for specific holiday properties has this issue and the future date is different for each.
I have no idea why this is happening?
The "2016" comes from the URL that's been indexed:
http://www.padstow-self-catering.co.uk/properties/map/46/2016/12
Presumably somewhere there's a page with that URL on, and Google indexed that.
Personally I'd probably make the date picker parameters URL parameters instead:
http://www.padstow-self-catering.co.uk/properties/map/46?year=2016&month=12
... or remove it entirely from your links. Either way, it's not that Google has "decided to index" pages for a future date - they're just pages.
(Note: I work for Google, but have nothing to do with web search. This answer should not be seen as being an "insider" post in any way, nor as representing the view of Google.)

Resources