Can't get Google Calendar to populate FullCalendar - google-api

I'm new to programming so please excuse the improper terminology, but I was able to get a basic FullCalendar added to my website and would like to populate the calendar based on one of my public Google Calendars. I followed the steps on FullCalendar's website for setting up Google Calendar but I still just see a blank calendar, even though there are events on the public Google Calendar. The only step I was unsure of when setting things up was the Authorized JavaScript Origins section of setting up the Google API. I am using a GitHub pages site and it would not accept the full path name for my site so I just put the main hub portion (https://username.github.io) in this Authorized JavaScript Origins field. Is this incorrect? What needs to go in this path if I am using the FullCalendar on a site with the following type of URL: https://stephmorgan.github.io/repository/ ?
<head>
<link rel="stylesheet" href="fullcalendar/fullcalendar.css" />
<script src="lib/jquery.min.js"></script>
<script src="lib/moment.min.js"></script>
<script src="fullcalendar/fullcalendar.js"></script>
<script src="fullcalendar/gcal.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#calendar").fullCalendar({
googleCalendarApiKey: "<API-KEY>",
events: {
googleCalendarId: "b3eki2m39g1lcfcq3nnl1vb9lo#group.calendar.google.com"
className: "gcal-event"
}
});
});
</script>
</head>
<body>
<div id="calendar"></div>
</body>

There are several problems:
1) googleCalendarId: "Calendar ID: b3eki2m39g1lcfcq3nnl1vb9lo#group.calendar.google.com" should be googleCalendarId: "b3eki2m39g1lcfcq3nnl1vb9lo#group.calendar.google.com", as per the example at https://fullcalendar.io/docs/google_calendar. It thinks "Calendar ID: " is part of the ID, which obviously it isn't, and Google won't recognise it.
2) The same issue with the API Key - remove the < and > from the ends of the string.
3) It sounds like you chose the wrong kind of credentials - the API key config does not contain a section from JavaScript origins etc. You must choose to create an API Key (sometimes called a Browser Key), and not Oauth Client ID or Service Account.

Related

Attribute gwd-events not allowed on element script at this point

I was making a html5 banner using Google Web Designer and one of the technical requirements for the platform I make it for is haveing no Errors in https://validator.w3.org/ . The main error is
Attribute gwd-events not allowed on element script at this point.
What can I replace it with?
<script type="text/javascript" gwd-events="handlers">
<script type="text/javascript" gwd-events="support">
<script type="text/javascript" gwd-events="registration">
Honestly I don't know what can I try in this case, because the code in autogenerated by Google Web Designer and events are part of it.

How i can translate article in codeigniter? the localization work on the app but not on thes artclles

I would like to know how I can translate the articles according to the language of the user ! the language set on the app when the user changes the language, the article must be translated also, localization is already set up in the app but not on the article! i should use an API for that or i can do it without? please tell me!
NB: I got only access via FTP so, I can install packages via composer!
please show me some example or link!
how I can use packages in Codeigniter without use composer, like download it directly from GitHub an put it in my project!
Put the following code in your website structure:
HTML Code:
<div id="google_translate_element"></div>
Javascript Code:
<script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement({pageLanguage: 'en'}, 'google_translate_element');
}
</script>
<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
This is for your whole website will be translated, I hope it works for you.

Google analytics doesn't work on my heroku app

I run a python web app on heroku platform,
using heroku sub domain like: example.herokuapp.com
and I add google analytics js code to my page:
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-xxxxxxxx-x', 'herokuapp.com');
ga('send', 'pageview');
I have insert this script over 12 hours, but when I enter my ga account admin panel, it tell me:
The Google Analytics tracking code has not been detected on your
website's home page. For Analytics to function, you or your web
administrator must add the code to each page of your website.
however, I still can see some PV on the report panel
Does the ga work or not? How can I solve this problem? If I use a top level domain could solve this problem?
Two things regarding your ga.create() call:
1) The third parameter ("herokuapp.com" in your case) is supposed to be a Javascript object, not a plain string. Did you actually mean {'cookieDomain': 'herokuapp.com'}?
2) If you did... then it should be example.herokuapp.com -- you can't set a cookie on all of herokuapp.com.
I've found that the new universal analytics is actually a little slow to kick in within the interface. The old Google analytics used to be like this and could take a day to work.
I have set up universal analytics on 6 sites now, I could see the calls being made to google but it took a day for data to show.
Have you used any debugging tools available.
For Firefox httpfox is a great tool, once installed select start and filter by 'collect' this will display analytics calls if they are working.
In chrome there are 2 good extensions, tag assistant and ga debug both by Google. Both of these can help identify implementation issues.
Hope this helps
John
Credit: https://towardsdatascience.com/advancing-to-professional-dashboard-with-python-using-dash-and-plotly-1e8e5aa4c668#cf77
Try this
import dash
app = dash.Dash(__name__)
app.index_string = """<!DOCTYPE html>
<html>
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-131327483-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-131327483-1');
</script>
{%metas%}
<title>{%title%}</title>
{%favicon%}
{%css%}
</head>
<body>
{%app_entry%}
<footer>
{%config%}
{%scripts%}
{%renderer%}
</footer>
</body>
</html>"""

Phonegap online method and window.location

I'm new to phonegap and I'm still trying to understand the basics. I want to make a simple app that when it starts up it checks to see if it has an internet connection and if it does I want it to redirect to a website or load that website in the web view. If it doesn't have an internet connection, then I want it to stay on the app and just display static content.
Here's what I have so far.
<!DOCTYPE html>
<html>
<head>
<title>Online Example</title>
<script type="text/javascript" charset="utf-8" src="cordova-2.1.0.js"></script>
<script type="text/javascript" charset="utf-8">
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
}
// Cordova is loaded and it is now safe to make calls Cordova methods
//
function onDeviceReady() {
document.addEventListener("online", onOnline, false);
}
// Handle the online event example
//
function onOnline() {
window.location.href ="http://google.com";
}
</script>
</head>
<body onload="onLoad()">
</body>
</html>
I also set OpenAllWhitelistURLsInWebView to true.
Does the online event only work if the app was offline then gets called when the app goes back online?
Thanks in advance!
No, Online event is fired when the app starts if internet is connected and it is also called when the app goes from offline to online mode.
If you want to open a external website in phonegap you can add a child browser plugin for the same Or else you can open a website in a embedded webveiw. window.location.href doesn't work in Phonegap.
I don't know whether you are working on iOS or Android so the link for iOS and for Android
Move your wiring up of the online event handler (i.e. this line):
document.addEventListener("online", onOnline, false);
up into your onLoad() function. I found that the online/offline events need to be registered on load, rather than later for some reason.

Facebook button for Ajax Pages, how to implement and verify that it works

I wanted to know how can I use Facebook Like button on my Ajax web application, that will capture changes in the Open Graph tags for both the og:title and the og:url. I already created a Facebook app and got an API ID.
What I want to know is the code that I need to put on my website in order for Facebook to capture the changes that I've made to the meta tags which contains that title and url information (ie. og:title, og:url).
I followed the instructions on Facebook without success. Furthermore, I want to know how can I locally test the Like button to see that it grabs the data from the Open Graph tags properly.
Also worth mentioning that I've a JQuery code that automatically alters the Open Graph meta tags to include the relevant information for the current Ajax changed page.
Thanks.
You will need to have a separate url for each different page that you want to allow people to like. I would recommend actually pointing the like button to the physical pages you're trying to return via the og:url tag. To refresh the data that Facebook stores about a given url, pass that url into the linter at http://developers.facebook.com/tools/lint.
i created a rotator file for facebook share on my dynamic ajax website.
rotator.asp code sample:
<html>
<% lang=request("lang")
id=request("id")
..some sql to get data...
ogTitle=....
ogImage=....
originalUrl=....
%>
<head>
<meta property="og:title" content="<%=ogTitle%>" />
<meta property="og:image" content="<%=ogImage%>" />
.....
......
<meta http-equiv="refresh" content="0; url=<%=origialUrl%>" />
//dont use redirect.. facebook dont allow 302...
</head>
<body></body>
</html>
for example xxx.com/#!/en/153 page will share xxx.com/rotator.asp?lang=en&id=153

Resources