Elastic Search with Symfony2 + Aggregation [Complex] - symfony

Facet Filter Demo
I'm creating a search page with Elastic search + Symfony2 using FOSElastica. I have setup repository and model transform and pagination perfectly fine.
I have geo-location search with couple of aggregation which are following
Distance Range
< 5 miles
25 miles
50 miles
100 miles
Duration between two points
30 minutes
1 hour
2 hour
3 hour
Categories
Car
Truck
Bike
Hover board
location: geo point (default is set by country)
Question
There will be multiple aggregation click by user to filter their data to narrow the data. What would be the best way to track which aggregation is active by the user?
And how can I show send and receive filter aggregation between controller and service methods?
Would it be best to just track everything by session?

Since the default Elasticsearch response doc does not contain the query that was submitted, you'll need to keep track of the filter selection state in a MVC application in order to properly render your filter controls.
Some options:
filters encoded into form elements (possibly hidden) on the page. Form could post via Ajax.
filters encoded into url (added benefit of bookmarkable/shareable searches)
filters stored in session (not sure why you'd want this, but it would be possible)
Once you've submitted a search request, your controller which calls Elasticsearch, is now responsible for passing the user's filter selection state to Elastica (and also back to the view along with search results)
This sort of echoing filter state back from the search controller is useful especially when you need to redraw the section of the page housing search filters.

Related

Get all real analytics data having condition 'custom:user_id="XYZ"'?

I tried to automate test to validate GA events.
My approach is :-
List item use google analytics real time reporting api.
Before the test ends i will hit this api and collect the last 30 mins data
This data will be a huge chunk of formattedJson string
and in this string i will search my GA events which was supposed to push.
This approach seems to be in-efficient.
My issue is to find the analytics data which corresponds to test user.
Each user has unique user id, hence, i am trying for making the request such that api returns me the filtered data based on some custom dimension "custom:user_id='user_unique_id'" .
Is it possible to get all data having condition e.g 'custom:user_id="XYZ"'.
Please advise, how to get all ga events data for a specific event label / custom dimension ? Also, does it support dimensionFilterClauses like reporting api v4 ?
We can do it by filtering.
e.g rt:eventCategory==ProductPage
earlier i was using quote, rt:eventCategory=='ProductPage' which wasn't supported.

reporting on event hits in google analytics

I have been tasked with using Google Analytics to report of use of a desktop app so we can see which parts of the program are being used and how heavily, and potentially also see which companies are using which parts of the program (each company has a unique companyID). Ideally I'd like to be able to look at correlations (e.g., How many users who use report A also use process B?)
I currently have my program set to fire off a call to analytics. I've set it up to use the event tracking, but I'm open to app/screen tracking or something else if something would work better. I'm passing values like
v=1
&t=event // Event hit type
&tid=UA-XXXXX-Y // our ID; real code has valid value here
&cid=12345 // CustomerID
&ec=JobFinancialReport // Event Category
&ea=Run // Event Action
&el=Manager // Event label
&ev=7 // Event value
What I can't figure out is how in Google Analytics to set up reports that would show me something like:
CustomerID Category Label Total Hits Unique Users
12345 JobFinancialReport Manager 27 2
12345 MarketingReport1 Manager 6 4
I'm totally new to analytics so pardon my ignorance if I have some key misconception here. I've searched Googles sites and other questions here, but I may be wording my question incorrectly so I'm not finding something that's there. This is only one example; in some cases we might want to see how broadly each customer is using the program; in other cases we'd want to take the customerID out and just see how much a particular report is being used overall. Appreciate any guidance. Thanks.
The "cid" parameter is the client id, the value that is used to stitch single interactions into sessions and users.
The first problem that comes to mind with your setup is that the client id is not exposed in the user interface (with the single exception of the user explorer report) or the API.
You would need to implement this via a custom dimension (probably user scope, since it probably will never change for a given user) where you pass in the client id (you still need the cid parameter).
Then you could create a custom report (or create a report in Google Data Studio) with the custom value as primary dimension and your selected metric.
If you want to report "Unique Users" you would probably need to create a cid per logged-in user (if all users of the app have the same cid then you will always have but a single user reported). You should then probably create a second custom dimension for the company id, so you can segment your reports by company.
you can use custom reports in google analytics to get your desired output. here is how to create custom reports https://support.google.com/analytics/answer/1151300?hl=en

Is it possible to fetch data from multiple Google Analytics tables in one request?

Looking at the API documentation linked below makes me confused. The parameter name "ids" suggest due to its plural form of "id" that I should be able to fetch data from multiple tables in one request, right?
However, this (vaguely) suggest the opposite:
The unique table ID used to retrieve the Analytics Report data. This ID is provided by the element for each entry in the account feed. This value is composed of the ga: namespace and the view (profile) ID of the web property.
https://developers.google.com/analytics/devguides/reporting/core/v2/gdataReferenceDataFeed#ids
What I want to do is fetch visitor data from more than one table in one request and get them summed up and ready to use.
Is this possible?
Thanks!
This is not possible. You will need to make 2 separate requests for each table ID.

Drupal: map address geolocation search

I am using the gmap and location modules to display a map. I would like the users to be able to fill an address in a field and the map autocenters and autozooms to that address. Like maps.google.com does it.
Is there a module or any specific configuration I can do with drupal? Ultimately I would like to create an advance filter where user inputs country, province and address and posibly select from a drop down list. Something very similar to what it is done in the following link http://www.dei.gr/Default.aspx?id=30608&nt=18&lang=2&langid=1
Thanks.
The GMap Location Module is the one which fits the requirements most closely.
"Provides a map of all a site's nodes and a map of all of the site users."
If you'd like to create it by yourself:
Would suggest to create 2 tables - with labels and center-points - in order to populate these cascaded drop-downs.
The last input-box needs to geo-code the entered text - over the Google GeoCoder API.
Of course any centerpoint could be geo-coded - but you have a limit of 2.500 API requests per 24hrs on the PHP API,
unless being a premier customer (besides local results are just quicker). That's why it's recommend to store the center-points for each item in the drop-downs in a table - and only use the JS API (instead of the PHP API) for the last step.
The example which you provided reloads the whole page when changing the drop-downs, which should be avoided.

ASP.net - Caching by Query-String (VaryByParam)

In which situations should we use Query-Strings (VaryByParam) to achieve Caching in ASP.NET?
Can anyone give an example of a real-life situation in case of an web-application?
Products.aspx?productID=12345
Obviously you don't want the output cache of Products.aspx to have the data for the first product that got requested.
In detail
If I hit Products.aspx?productID=12345 the page will be processed for me, look up the info for product 12345, and cache the results. Then you hit Products.aspx?productID=54321, the page will not be processed for you but products.aspx will be retrieved from the output cache and you'll see the info for 12345. Not good. VaryByParam resolves this.
The most classic example may be: A product catalog
It may have a URL structure like so:
http://www.myshop.com/Catalog/ViewAllProducts.aspx
http://www.myshop.com/Catalog/ViewAllProducts.aspx?PageNum=123&PageSize=50
http://www.myshop.com/Catalog/ViewProduct.aspx?ProductID=12345
The first URL is the complete list of all products. There's no querystring here, but the second URL is the same page but with pagination. The Page Number (PageNum) and the number of items per page (PageSize) are both querystrings, so assuming the user couldn't re-order the product list, two different users requesting the:
http://www.myshop.com/Catalog/ViewAllProducts.aspx?PageNum=123&PageSize=50
URL would be getting the same information. The first request could cache this data so that the second request at a later time doesn't need to go back to the database to get the product items (and the details related to them: price, description etc.) in order to display them.
The third URL is a single product detail screen with the Product ID (which could be a unique identifier from the database) as it's single querystring parameter. Multiple requests for this will almost always need to return the same data (unless the price or description or some other element of that specific product changes on a frequent basis). Caching based upon the "ProductID" querystring (and it's variations in value for different products) will greatly reduce load of the database. Ensuring the cache duration isn't too long will ensure that the cache is expired in a reasonable time should the actual back-end database data change.

Resources