Using API to create a Google Calendar event and conference accessible without Asking to join - google-calendar-api

I am able to create a google calendar with conference using the following code:
Event event = new Event()
.setSummary(calevent.getTitle())
.setDescription(calevent.getDescription());
ConferenceSolutionKey conferenceSolutionKey = new ConferenceSolutionKey().setType("hangoutsMeet");
CreateConferenceRequest createRequest = new CreateConferenceRequest().setRequestId("xxsdswwadx")
.setConferenceSolutionKey(conferenceSolutionKey);
ConferenceData conferenceData = new ConferenceData().setCreateRequest(createRequest);
event.setConferenceData(conferenceData);
DateTime startDateTime = convertDate(calevent.getStartDateTime());
EventDateTime start = new EventDateTime()
.setDateTime(startDateTime)
.setTimeZone("Europe/London");
event.setStart(start);
DateTime endDateTime = convertDate(calevent.getEndDateTime());
EventDateTime end = new EventDateTime()
.setDateTime(endDateTime)
.setTimeZone("Europe/London");
event.setEnd(end);
But this does not allow invitees to join without waiting for moderator to accept them. On google calendar, there's a settings for conferences called 'Quick Access' that when turned off, allows anyone to join without having to be approved.
Can this be set when creating the conference?

Answer:
I don't think you can manage these settings via Calendar API. None of its resources include any field related to this.
Feature request:
I couldn't find any related feature request in Issue Tracker.
Therefore, if you're interested in this, I'd suggest you to request this feature using the corresponding Issue Tracker template.

Related

campaign_details event is not logged in firebase

I have created a campaign link and when i give
Bundle data = new Bundle();
data.putString(FirebaseAnalytics.Param.SOURCE,Applink.getQueryParameter("utm_source"));
data.putString(FirebaseAnalytics.Param.MEDIUM,Applink.getQueryParameter("utm_medium"));
data.putString(FirebaseAnalytics.Param.CAMPAIGN,Applink.getQueryParameter("utm_campaign"));
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.CAMPAIGN_DETAILS, data);
But the event is not logged in firebase. have anyone faced similar issues? could you please let me know what im missing?
Seems that campaign_details events are only visible if you search through Big Query.
You can easily retrieve those events with the following query:
select * from `[tablename]` where event_name = 'campaign_details'

Google Analytics UserID API extraction

Trying to extract a userID from GoogleAnalytics. This is to view which user is the using the website most and least.
I would to retrieve the top 5 user IDs and bottom 5 user IDs that were passed using either:
gtag('config', 'GA_TRACKING_ID', {
'user_id': 'USER_ID'
});
OR
using a custom dimension... ( https://support.google.com/analytics/answer/2709828?hl=en )
I'm (vaguely) aware of policies and TOS to keep 'non identifying' information on Google BUT there are posts online indicating you can link back to CMS data.
Steps so far
Google Analytics with UserID and view setup - Working in Google dashboard and showing filtered userID and All website data using the idea.
Requirements:
Extract page view and session data for each userId between a date
range (or all by default)
UserID via standard GA method
UserID via Custom dimension method
Any help, pointers or examples how someone has completed something like this are appreciated.
NOTE: This is to PULL data out of GA and manipulate/display it on an external system/dashboard.
Seen this which states it's not possible: Google analytics userID tracking
and this which states it (kind of) is google analytics API implementation for tracking a specific user activities in php
The solution I used:
Tracking
Create Google Analytics account
Create a new view by activating the UserID tracking (labeled NewView1)
Use https://developers.google.com/analytics/devguides/collection/gtagjs/custom-dims-mets
i.e. Define your custom dimension
Get Analytics tracking code + Add custom definition code
Create a Custom report using the 'metrics' you want to see and filtering by the 'custom dimension' I created earlier.
(note: data took ~ 12 hours to be visible so don't expect to work instantly)
Front end tracking additions
gtag('config', 'GA_TRACKING_ID', {
'custom_map': {'dimension<Index>': 'dimension_name'}
});
// Sends the custom dimension to Google Analytics.
gtag('event', 'any_event_name', {'dimension_name': dimension_value});
Extraction
Create New Google Developer Console Project (API)
Use a Service Account to connect the API with Analytics ( https://developers.google.com/analytics/devguides/reporting/core/v4/quickstart/service-php ) -- API -> credentials -> Create Credentials (Service Account key)
(assign role [mine was set to Project => View])
Save the Text file to your filesystem and rename to json as per examples
Add permissions to your Analytics project by copy/pasting the 'Email' from the Service account details into Analytics User Management.
Get the view ID of the data you wish to extract (Analtyics created in step 2 in tracking)
Use the sample Code (HelloAnalytics.php) to connect and extract data
Use your custom dimension to filter results
The dimension filter I used was $dimensions (see below)
...
$dimensions = new \Google_Service_AnalyticsReporting_Dimension();
$dimensions->setName('ga:dimension1'); // as per docs
// Create the ReportRequest object.
$request = new \Google_Service_AnalyticsReporting_ReportRequest();
$request->setViewId($VIEW_ID);
$request->setDateRanges($dateRange);
$request->setMetrics(array($sessions, $pageviews));
$request->setDimensions($dimensions);
From there I was able to see the same data via API that I could see in the custom report on analytics web.
NOTE: be careful of which Google project and view you're in while setting up
permissions and dimensions.
NOTE: using gtag() code and not Universal (ga()) js code
The answer is a very brief/rough summary of how I achieved my specific goal. It is not a one-size-fits all solution but hopefully it will give someone a better idea of how to set and extract custom variable data within Google.
The final result was data from the API. From there it's up to you.

Adding an Event for Espresso on Wordpress from C#

Working with WordPress and the Espresso Plugin for Events. I've never dealt with WP or Plugin's before, so I'm in new territory.
I am attempting to add an event and I keep getting the following error:
{"code":"rest_cannot_create_events","message":"Sorry, you are not allowed to create events. Missing permissions: ee_edit_events,ee_edit_others_events,ee_edit_private_events","data":{"status":403}}
I've gone into the WP admin pages and made sure the user I am trying to login as has all the permissions for this plugin.
The first thing I do is access the /wp-login.php page to get the Cookies:
string formVars = "";
string result = "";
string eventUrl = $"<url>/wp-login.php";
Dictionary<string, string> headers = new Dictionary<string, string>();
formVars = $"log={UserName}&pwd={Password}";
Cookie = new System.Net.CookieContainer();
AllowAutoRedirect = false;
result = PerformPost(eventUrl, formVars, true, headers);
The PerformPost uses an HttpWebRequest to send and receive.
That part seems to work and I get what looks like valid cookies.
I then do another post to /wp-json/ee/v4.8.29/events/ and pass in the body just the name of the event like EVT_name=TestEvent.
It's at this point that I get the the error mentioned above.
So a couple of questions.
1) Has anyone done this before? (Added an Event to Espresso on WordPress)
2) If Espresso doesn't like what I am feeding it, does it generate this error rather than just telling me I'm not giving it the correct information?
I've also tried using the Basic Auth plugin with the same results.
Any help is greatly appreciated.

Why is Analytics Reporting Api data not matching with Google Analytics Dashboard?

I am working on an analytics module which pulls data from Google Analytics, Facebook and Twitter Analytics api.
Using Analytics Reporting Api V4 to pull the data from Google Analytics.
Total number of sessions value does not match with what I see on Dashboard. I am using metric ga:sessions to pull the number of sessions.
In some cases, the number of sessions coming from reporting api matches with Dashboard. But not all the time. I am finding it hard to get it approved from QA without a proper explanation.
I checked dimension filters and reporting query multiple times but couldn't find anything wrong with it.
Added the samplingLevel to my report request but still seeing the same result.
ReportRequest totalNumberOfSessions = new ReportRequest().setViewId(VIEW_ID)
.setDateRanges(Arrays.asList(lifetime))
.setDimensions(Arrays.asList(custom))
.setDimensionFilterClauses(Arrays.asList(clause))
.setMetrics(Arrays.asList(sessions))
.setSamplingLevel("LARGE");
According to https://developers.google.com/analytics/devguides/reporting/core/v4/samples, use setSegments instead of setDimensionFilterClauses.
Like this:
String path = "<your_path>";
SegmentDimensionFilter exactPathDimensionFilter = new SegmentDimensionFilter()
.setDimensionName("ga:pagePath").setOperator("EXACT")
.setExpressions(Arrays.asList(path));
SegmentFilterClause exactPathSegmentFilterClause = new SegmentFilterClause()
.setDimensionFilter(exactPathDimensionFilter);
OrFiltersForSegment orFiltersForSegment = new OrFiltersForSegment()
.setSegmentFilterClauses(Arrays.asList(exactPathSegmentFilterClause));
SimpleSegment simpleSegment = new SimpleSegment()
.setOrFiltersForSegment(Arrays.asList(orFiltersForSegment));
SegmentFilter segmentFilter = new SegmentFilter()
.setSimpleSegment(simpleSegment);
SegmentDefinition segmentDefinition = new SegmentDefinition()
.setSegmentFilters(Arrays.asList(segmentFilter));
DynamicSegment dynamicSegment = new DynamicSegment().setSessionSegment(
segmentDefinition).setName("Path pageviews");
Segment segment = new Segment().setDynamicSegment(dynamicSegment);
ReportRequest request = new ReportRequest().setViewId(VIEW_ID)
.setDateRanges(Arrays.asList(dateRange))
.setMetrics(Arrays.asList(metric))
.setDimensions(Arrays.asList(new Dimension().setName("ga:segment")))
.setSegments(Arrays.asList(segment));
This example uses a path filter. You should change it according to your "clause" variable.

Google Analytics Get Custom Dimension After Setting One

In Google Analytics, after setting a custom dimension via:
var tracker = ga.getAll()[0];
tracker.set('dimension1', 'myCustomValue');
tracker.send('pageview');
I'd like to then GET the custom dimension value for that user when a user navigates to another page, via something like:
var tracker = ga.getAll()[0];
var dimension1_value = tracker.get('dimension1'); // 'myCustomValue'
Is there a way to do this?
There is no way native to Google Analytics to do this. Values are not stored in cookies anymore and there is no backchannel to the analytics server, get after set only works on the same page.
But of course nothing stops you from setting your own cookie/session storage and store the value(s) there (but then you knew that).

Resources