How can I query Google Calendar color labels? - google-calendar-api

In my Google Workspace account, I use color label strings in Calendar to track time. I want to use these to automate timesheet reporting using the Calendar API. How do I access the label strings associated with each color ID?
The Colors resource (2022-12-19 version) only provides foreground and background color data, no label string. Also the Settings resource (2022-12-19 version) does not provide what I need. I have also tried the CalDAV API (2022-12-19 version) but that does not seem to provide color or label information at all.

In the actual state there is no way to query the color label of the Time Insights.
You can review the feedback about features and functionality in Issue Tracker, review if someone has submitted the same one, if not, you can submit a new feedback report.

Related

Google Calendar API: Display Name doesn't work

I am faced with a strange problem: displayName property is not applied/saved on event level. Here is a link to the API documentation: https://developers.google.com/calendar/v3/reference/events
I fill in the displayName for the organizer and attendee in the event and then save this event. But in emails displayName is nowhere showing. I expect to see it ideally in the email as <{DisplayName}>#organizer email. That's an issue I am trying to solve but I see it nowhere at all. I read this event from google calendar using event id. And there's no property displayName in organizer and attendees fields.
I double checked and I use v3 of the Calendar API, so I believe I am checking documentation for the same API version I use in the code.
I understand that you create a Events resource and want to get the values for organizer.displayName and attendees[].displayName. In that case, then everything is working as described. In the Events resource it is stated that those properties are subject to disponibility. Also, in the case of attendees[].displayName, it is optional too. Both properties are writable, so ideally you could include them in your requests. Please, ask me any additional doubts.
the answer lies in the Google+ replacement, "Currents". If you have Google Apps for Business, make sure Currents is available for your users, and then from within Currents, make sure the users you want to have the 'displayName' appear for have an "active profile". As an admin for the organization, you can make profiles active on users' behalf. Once they have an active profile under Currents, the "displayName" will use the name associated with the account.

Event color settings are not preserved when a calendar is exported

Customized event colors (foreground and background) are not preserved when you export a calendar since there is no reference on the generated ics file about them. When the calendar is imported from the ics file, all the event color settings are lost. Is there any way to preserve the event color information using the Google Calendar API ?. Thanks.
According to the post and further drilling down to this google calendar API post,
Google API calendar currently does support that.

Pulling Google Variable Into Hidden Field

I've started parsing out the Google UTMZ_ cookie and am looking for any possible way to push that information into Marketo hidden fields. I currently create and populate Marketo hidden fields based on Google Tracker fields, but I can't figure out how to do it with the fields in the attached image.
I'm wondering if anyone has any insights into how I could push those fields to a form. Below is the code I use for pushing Google Tracker fields to Marketo.
MktoForms2.whenReady(function(form){
ga(function(){
form.addHiddenFields({
GA_User_ID__c : ga.getByName('gtm1').get('userId')
});
});
});
Universal Analytics does not use utm cookies, and it does not have custom variables (they have been replaced by custom dimensions), so your version of the GA code does not match the information from your screen shot.
Since campaign attribution is now done completely on the Google servers you can no longer get the information via client side GA code. You would either have to pull that information via the API (which I do not think is feasible in runtime) or build your own solution to try and match Google's campaign attribution (as displayed here in a flowchart).

Google Analytics API For getting total clicks and impression on element

I am really new to Google Analytics and I had a requirement of tracking clicks and impressions. I followed following link
http://www.statstory.com/tracking-clicks-and-impressions-in-google-analytics/
and sucessfully implemented the same.
Now my requirement is to get the no.of clicks and no. of impressions
to my html page. I am googled for past quite hours but couldnot find
any luck with the same.
Any help would be highly appreciated.
You should really consider implementing Google Analytics Enhanced E-commerce functionality.
Google Analytics Enhanced E-commerce
In regards to answering your question of the API, you should query it asking for events. Namely category, action and label events and apply a filter to only return the data you wish to receive, such as 'Impressions' as a filter for 'Event Action'. That will return all impressions and if you instead change the filter to use 'Click', you'd get all clicks instead.
If you followed the above guide and made it into Universal, then you'd see the calls you set and it is set up in the following way:
_gaq.push(['_trackEvent', 'Banner', 'Click', 'BANNERNAME',1.00,true]);
This bit of code pushes (legacy version) Analytics data in the form of:
_gaq.push(['_trackEvent', 'Category', 'Action', 'Label',1.00,true]);
So, changing the different sections means you change how you define the data and how it will be visible in reports. Category defines the Event Category, Action defines the Event Action and Label defines the Event Label.
Take a look at the core development guide. Also, here you can see all the API calls available: Dimension & Metrics explorer for Google Analytics
I gather that you want to track impressions for banner advertising that is displayed by yourself (i.e. not through an adserver) in your website.
I agree with Mr Sponge that you should upgrade to Universal Analytics. if you want to implement enhanced e-commerce tracking (EEC) you probably want to read about Measuring internal Promotions, which is a feature specifically build for that kind of reporting.
If you just need the raw number of banner impressions and/or need a solution that's easier to implement (but less capable) you can increment a custom metric every time you banner shows up (this is basically a counter, you might want to use it together with a custom dimension that holds the banner name). Click tracking would still be done by events (with similar custom metrics and dimensions). From that data you can assemble a custom report and use a calculated metric for click through rates etc.
Not as good as EEC by a fair margin but much easier to do.

Is there anything wrong with the way I'm implementing a Calendar on my site?

I am setting up a website for students of a school, which must include a schedule page which will show a calendar with events populated by feeds from various teachers' calendars. After trying out a variety of scripts and tools made for showing calendars, I finally hit upon a very shoddy, hacked-together way of doing it, and I want to know if theres any specific things wrong with my implementation.
My requirements from this calendar are posted in a previous question
This is how my implementation is gonna work:
The teachers make their schedules in their own calendar programs and make those feeds available in the iCal format. A common Google account for the school subcribes to all these calendars, and so gets read only access to ALL the teacher's schedules in school.
Google Calendar has a feature that lets you select some of your calendars, and then get the html code for an iframe to embed on your website, so that visitors to the site can see what events are coming up. When I experimented around with the options in the Google 'Configurator', I found that by simply including certain codes in the url called for the iframe contents, you could change which calendars were visible. These codes, or calendar ids, are clearly displayed in the settings for each calendar. Thus, my final solution is thus:
For every student, there is a record stating which courses he has taken, and hence which calendars he should be shown. With some SQL magic, I can retrieve the calendar ids from a pre-prepared database of all the calendar ids, and then generate the correct url for the iframe using php, and display it.
I hope that wasn't too convoluted to understand. Now can anyone tell me if there are any inherent security flaws or bad programming practices etc in this. Something about the whole idea of dynamically generating urls, using iframes, using a common google account etc just screams 'Mistake!'. Can someone tell me if this is an ok way to go about it, or is there some problem with it?
Actually, I think your solution has the potential to be very secure. Using a single google account to collect the read-only calendars into one place is just an organizational shortcut. As long as the calendars themselves are read-only, your single account contains nothing that isn't already public.
Generating URLs is perfectly reasonable, as long as you are combining strings that you've sanitized beforehand. Since your database can only get calendar IDs from your aggregation google account, you know that potentially malicious users can't cause arbitrary characters to end up in your synthesized URLs.
The biggest problem you'll probably run into is that the google embedded calendar iframe only allows up to ten calendar feeds.
The most likely security vulnerability you'll face is the security of all of the teachers' google calendars.
By default, google calendars accept "invitations" and post them as events. You might find that anyone can "invite" a teacher's calendar to prank events and those prank events will then show up on student calendars.

Resources