I have two date selectors on my website (from:to) and I would like to track the date range selected from these selectors. So if a user enters, for example, From [May 6th, 2018] To [June 6th, 2018], I would like to be able to track the range of date that was selected in Google Analytics.
Is there some way to do this? I thought about Event Value, but this is only for integers so it does not really apply...
Event Category, Event Action, and Event Label accept strings; and Event Value accepts integers. Therefore there is no ready made solution to track date values.
The best option is to track dates as strings in Event Label - e.g. 2018-05-08
Related
I have an Event content type with a Date range field. I created a view of events and added an exposed filter for the Date Range field. I used the operator 'is between', so the user can enter a start date and end date to search between.
If the event starts on 1/1/11 at 9am and ends on 1/1/11 at 5pm, I want this event to show up when the user filters for events between 1/1/11 and 1/1/11.
But there are no results unless you change the end date to something greater than 1/1/11. I know this makes sense according to the 'is between' filter but I don't think it will be intuitive for users.
Can anyone help me with a way to make the end date inclusive, so it includes events on the end date specified??
I'm using the datetime_range module, and I've patched it with #60 at https://www.drupal.org/node/2786577 to enable date range filtering with views.
Thank you
I believe you're going to need the Views Date Filter Datetime Granularity Option patch (until it gets committed) as well as the change from The Views integration Datetime Range fields should extend the views integration for regular Datetime fields, which is now in Drupal core 8.6+.
For even better UX, see Exposed views date filter with offset not working as expected
I think I saw before below Event Category, Event Action and Event Label, there was Event Value. Now there is no. Can this be the case?
My events have category, action, label and value that is integer.
No. The event value is an integer. Generally when you can do mathematical operations on a data field (event values add up) it is a metric rather than a dimension. If you try to send a string as event value you'll see an error in the GA debugger and most likely your event tracking will fail.
Event value is in fact supposed to be a currency (which does not quite work out, since it does not accept decimal numbers). The idea is to express the value of events that are not transactions as monetary value.
You could store a (stringified) version of the event value in a custom dimension. It would not by default appear in standard reports, you'd have to select it as secondary dimension or use is as a custom report. Also the values would no longer be added up.
I have the website where merchants sell some stuff. Each item has stats like unique views during last 24 hours, a week and a month and a number of visitors that clicked on "show contacts" button. Uniqueness based on IP. This works, there're huge tables that collects all (IP,item_id) pairs during the last month, and there're a lot of updates.
Today I dig into google analytics api, I would like to know if it's possible to use it instead of my system.
The fact is all this stat is private, available only for merchant, so I don't need to have all stat at a time (it's not compared etc.). So it might be requested on demand for the specific item.
I created service account, connected it to analytics data and it seems export works (based on this example). Then enabled event tracking for "show contacts" button.
For example, when user click on "show contacts" where should I add item_id? Is it eventLabel or eventValue? So, for item_id=1234 it should be
ga("send","event","Contacts","show","",1234) or ga("send","event","Contacts","show",1234)?
I'm confused with eventValue column in Top Events report (it seems that eventValue keeps a sum of all eventValues and even caculates Avg.Value). Does it mean item_id should be stored in eventLabel as string?
I added second, nonInteraction event for collecting item views, ga("send","event","Data","show","1234",1,{nonInteraction:true}). It count all events, but I need only unique ones (performed by unique visitors) in specified period of time (day, week, month). Is it possible?
1) The parameters are category, action, label and value. "Value" is a metric and is expected to be an integer. Since it's a metric it will be added up. So if you do
ga("send","event","Contacts","show","",1234)
you will increment a metric by 1234, not store an id. You do not want this (especially if you have a linked adwords account, since this will be used to calculate your "return on advertising spent").
You want to use your item_id as label, however label is a string. So what you need to do is:
ga("send","event","Contacts","show","1234")
i.e. wrap the value for your label in quotes.
2) Is there anything wrong with ga:uniqueEvents for your purposes ?
I'm trying to work with the ASP calendar control and (for starters) highlight the specific days on the calendar that matches DueDate in the 'task' table. I know how to highlight a cell using the DayRender event, but how do I do this in accordance to the database table?
Would then also like to be able to click on the highlighted cell and see details of the task associated to that date in some sort of box next to the calendar.
Any pointers on how I can solve this?
Pseudo-code:
Determine your desired date range (probably a certain month)
Read all the tasks that have due dates within that date range (probably need Name and DueDate at least)
In your DayRender handler you check if current day's date exists in the loaded tasks's due dates, if it does, highlight it with the color of your choice
In you SelectionChanged handler you obtain the selected day's date, and look through the loaded list of tasks for any tasks that have that date as their due date, and populate whatever box with those tasks.
When an event is clicked, is there any way to determine which date this event falls on? Im running into this issue when dealing with events that span multiple days, and since the event only contains a start and end date, I have not found any way to ascertain which date of the multi-day event was selected.
You can pass additional fields into your JSON object when you bind up your events.
For example, I pass in a "leave" parameter that tells me whether an event is an appointment or a part of the day off.