Script to get eventId from selected google calendar event - google-calendar-api

I am trying to make a chrome extension that will pull out properties from an event selected on the google calendar web interface and format them into text that can be pasted elsewhere. The part I am struggling with is how to get the eventId from a selected event. So if I go to a calendar and click on an event, this script should be able to get the eventId for the event in focus (example below) and then call the get() function for that event.
Example of selected/in focus event
I have only tried searching documentation and asking AI. Not finding anything.

Related

Events trigger after next click in Google Tag manager preview

My custom event does populate into my GA4 Analytics, but during testing, the events in the GTM preview don't show up until the next click after the triggering event.
Oddly, it seems that after the initial trigger of each event (with the followup click) they appear to
For the follow-up click, I can click anywhere on the page.
The trigger is set to "All Elements" and Firing when the element matches a CSS selector of [data-XXX="XXX"] and the page URL contains a keyword.
I'm concerned that due to the extra click needed I may be losing some non-zero portion of data. My site doesn't get too many of this particular event so every one counts. The event tracks our online reservation and I need it to be accurate in our Google Ads data so our ROI on ad spend is as accurate as possible.
I know there's a trigger on form submit, but the form doesn't actually trigger this way due to JS. And it does work with the "All Elements" trigger I'm just concerned about the extra click before I see it populate in the preview window.
After closer inspection I found that the followup click is not required.
The summary view does not appear to show ALL info for every single click in realtime. Instead if you choose to look into the data for each click as the happen you can see that the events are triggering as intended, but that new events don't always show in the summary view until after the next click registers.
Hopefully, a future GTM update may fix this as it is not intuitive that the summary view would ever not have the most current data.
TLDR: check the view for each click in the GMT preview and don't rely solely on the summary view.

Keeping user properties between events (Google Tag Manager, Google Analytics 4)

I have a question about user properties in Google Analytics 4.
I created 2 events:
The first one is called custom_session_start and it is triggered every time new session started.
The second is called UI_Interaction which is event that triggers every time that the user is clicking on something in the website.
The custom_session_start has some user properties and event parameters his specific tag in GTM.
The UI_Interaction event has only event parameters in his specific Tag.
From what I know the user property should be save unless I change it manually, so if I created some user properties in custom_session_start they also should be appear in UI_Interaction.
However, when I create a report in GA4 the user properties are only set in every custom_session_start event and they are empty in UI_Interaction event.
Is there a way to keep them also when the UI_Interaction occurs?

Don't create a new event on eventReceive with Full Calendar

I'm working on a page where events are creating by dragging from a list onto a full calendar object. I'm then opening a dialog (bootstrap modal) to let the user edit the event.
During the edit, they might change the date or time of the initial drop. They could also conceivably cancel the event creation.
What I'd like to do is:
Don't create the initial event and just save after the modal is responded to. That is, I'd like eventReceive to fire, so I can trap it, but not have FullCalendar add the event to the calendar.
It's all here, just not in a 'recipe' manner: https://fullcalendar.io/docs/external-dragging
Set create to false in the Draggable and handle the drag with the drop event.

custom event trigger in google tag manager

Every time i create a custom trigger event it doesn't get fire. Can anybody please what may be the reason. I have created 'gacustomevent'custom triggerand have name it 'gaevent' but the event is not getting fired. Iwant to use the event in the dataLayer to capture the value. Any advice on how to get issue resolve
It's a bit unclear from your question how you set this up. It should look like this:
dataLayer.push({
'event':'myEvent'
})
(this assumes that the dataLayer is already initialized).
In GTM you go to the "variables" section. In the boxes with the predefined variables you hit the checkbox in front of "event". Now you're ready to use your custom event in a trigger.
Go to "trigger", select new -> custom event. In the event name box you enter "myEvent" (as per my example, substitute with your own value).
The custom event only works when there is a key/value pair in the dataLayer where the key is "event" (that's kind of a 'reserved word' in GTM). The event name is always the value for that key.

Does full calendar have to re-render every event after an external event is dropped on the calendar?

I'm building a calendar that allows users to drag external events onto the calendar. When they do this an ajax call fires of and saves the event to the database. In order to understand what event is then resized or indeed rescheduled i update the event with the id of the event ive just created in the database. This means that if i need to further update the event. i.e someone moves the event or indeed changes the duration etc i can fire of the id with another ajax call and update the event.
The issue is that each time an event is dropped on the calendar, every event seems to re-render wiping out the id's that id added to each event. Are there any ways to prevent a full re-render? or a way to preserve id's on the element? you can see below i add the id occurance-387 to the html however when i add another event this gets wiped out. Any help would be appreciated! :-)
<a class="fc-day-grid-event fc-event fc-start fc-end fc-draggable fc-resizable _fc4" id="occurance-387"><div class="fc-content"> <span class="fc-title">A Very Short Introduction to… Anxiety</span></div><div class="fc-resizer"></div></a>
Don't add your id to the html. You should be storing your id as a property in the eventObject. Then, when you need to update your database, you can get the id out of the eventObject.
eventResize: function(event){
$.ajax('http://myendpoint.com/?saveNewEndDate", {id:event.id,newEndTime: event.end.format()},function(data){
if(data) {alert('Success!');}
});
}
There are other variables passed to the function that could be useful: delta, revertFunc. Check the documentation for details.
In my implementation, anytime a new event is saved to the calendar with drop callback function, my ajax response returns a json representation of a calendar eventObject and then I call renderEvent method to add it to the calendar. My json event object contains an id property.
$(#calendarContainer').fullCalendar('renderEvent', results.calendarEvent);

Resources