Integrate Google Analytics Dashboard in Rails - ruby-on-rails

I have found the following site on google: https://ga-dev-tools.appspot.com/demos/embed-api
Telling me about the Google API Demo.
Now how do I implement these things in a page in Rails, this is not clear to me.
What we want is to show a few "Dashboards"(Page views today, etc ..) in Rails Admin or a Separate page in Rails.

It's a Javascript library, so you would create new a view and paste some HTML and JS into it. You'll have to make sure it works with your application layout. The Embed API - Getting Started guide shows the code to get a dashboard up and running.

Related

Netlify CMS - blog posts from BitBucket show on front end but not back end CMS

I am having a problem using Netlify CMS with BitBucket.When I create a post in the CMS editor it saves correctly to the BitBucket repo,Netlify does a build and it publishes to Gatsby front-end without any problem.
However,when CMS is refreshed,none of the posts are visible,so cannot be edited without going into BitBucket and editing directly or pulling to local repo for editing and pushing again.Obviously this defeats the purpose of a CMS in the first place.
For reference I am using the Kaldi Gatsby/Netlify CMS starter the source code for which can be found here.
Here is what I see in the CMS directly after a post is created.
But when the CMS page is refreshed the Blog list is empty despite the post saving to BitBucket and showing on front-end.
I have looked through the Gatsby code trying to find something which could be causing the posts not to display in the CMS,but cannot see anything.If anyone has any ideas where to look or why this is happening I'd be grateful for any help.Thanks in advance!
UPDATE
Incidentally,the web pages included in the Kaldi template show up fine in the CMS.
I checked the console after trying to load the blog collection and it lists the error below for all the post markdown files.So it seems the CMS is trying to get them but can't for some reason.Unfortunately,the expanded view of the error doesn't offer any pointers to the source of the problem.
Thanks again for any assistance!

How to debug MVC web app with rest api controller backend? [duplicate]

In VS 2012, I am attempting to create an MVC 4 web application with jQuery calls to a Web API project. (Other devs will be consuming the API with our current, native app, and probably adding to the API in the future.) So I have one project that is the Web API, and another project that is the MVC 4 website. I can only set one of them to run, and they use localhost:xxxxx.
How do I debug changes to both? For example, let's say I add a new API path /api/customer/get and then a new jQuery ajax call to that path and do something with the resulting JSON. I've changed code in both projects and want to follow it end-to-end; how do I launch both? How do I debug both?
Just to be clear, the MVC app isn't making server-side calls to the API, I'm using MVC mostly to be able to easily use bundling, minification, and (hopefully) pre-compiled Handlebars templates in .NET; the API calls are coming from jQuery. As I am still relatively new to these technologies, alternate suggestions are welcome.
Thank you in advance.
I had the same problem and have found a solution from here:
forums.asp.net
The fix is to do the following:
In your solution file, click properties go to the Startup project node (if it is not already selected)
Next select Multiple startup projects. Select your website and your webservice and in the Action column make sure both of them have "Start" selected.
Now when you debug your website and put a break point in your webservice, it should hit the break point.
Coming late to the party but in case anyone else is looking for a solution, this is what was best for me: Set the Api project up to be the starting project (I needed to limit to one startup so that I could flip between browsers more easily). After firing up the service project, right click on the web/ui project and select debug, start new instance. You'll have both running and you'll seamlessly step from web to api.
I had a similar problem with my web api project. My solution consisted of an angular front end with 2 web api projects on the backend. One web api project handled "authorization" and the other handled "resources". I used the following tutorial by Taiseer Joudeh as a starting point:
http://bitoftech.net/2014/09/24/decouple-owin-authorization-server-resource-server-oauth-2-0-web-api/
Breakpoints worked on the "authorization server"... but not on the "resource server". I compared the packages from the two projects to see what was different. Once I added "Microsoft.AspNet.WebApi.Cors" to the "resource server" project, the breakpoints starting working.

Rails 4.1 analytics and site verification

My site is in Rails 4.1.7 and is hosted in Ninefold.
I want to verify and add Google Analytics to it.
I tried uploading html file in public folder, no go.
I tried creating controller and route, didn't work.
I tried a couple of solutions that were supposed to do a workaround in turbolinks and added the analytics script to the footer. Didn't work
Any ideas?
I must add that in the first two solutions, the html / action were accessible through the browser call but not through external links (when you try to verify, it gives you a link in webmasters tools), which has led me to believe it's a csrf situation, where rails blocks incoming connections from other websites.
UPDATE: I have this solution live, analytics shows me some data but site verification still does not work.
UPDATE 2: Ok, i solved it. The problem was that i had stated the domain as domain.com in Ninefold and forgot about it, and then i was trying to verify www.domain.com in Google. Solved by adding the extra domain and verifying both of them.

Zendesk app integration

I created a web application by using HTML, JS, JQuery, and some Jquery plugins. Now I want to integrate it into Zendesk. Can I use it like just copy all my files and paste it into zendesk zip file ? Or Do I have to re-code entire thing to make it work for ZenDesk ?
I checked the examples in online, they didn't mentioned anywhere about reusing the apps that already developed in Zendesk.
I am currently doing some fairly extensive Zendesk integration. If you are referring to customisation on the Agent Portal side then it will have to be a Zendesk App under strict Zendesk adopted frameworks jquery is included (http://developer.zendesk.com/documentation/apps/). If in the customer facing Help Center you can simply go into there on screen editor and paste your html, js, etc into the relevant sections see (https://support.zendesk.com/entries/22618341)
Good luck,
Tris
If you want to integrate your app to Zendesk as an Agent App, you might consider the chance of using within an iframe.
Note that the url to which the iframe is pointing to must be served as HTTPS. Otherwise, it won't work.
EDIT:
As of version 2.0 of ZAF (Zendesk Application Framework), it's easy to integrate any webpage. In v2.0, you aren't restricted to any technology or environment.

Google Website translator translates only single page in Rails

I'm trying to have a multi language website in rails.
So I added the google translate from here
I added the meta script to my application.html.erb so that my whole site is translated.
And the div to my index page only.
But it just translates the index page and not the whole site. When I open the links in the index page they don't get translated. I don't want to add that div to every page in my site.I read this stackoverflow sloution here but that is not working for me. Suggest a solution.
I'm also aware of the Rails I18n library for internationalization but I guess I need to write all the translations myself manually, which I don't want to do.
Can I18n be automated like Google translator?
Are there any alternatives to that which work in fine in Rails?
You have to add the Google translate plugin code to every page or to which ever page you want to make it work .

Resources