How to display data in Accelerated Mobile Pages(AMP) from firebase - javascript

I am create AMP Pages in my web project, I need to display data from firebase in AMP pages.
I use php and JavaScript to display data from firebase in web application.

Amp pages are meant to be cache by google which means you need to server-render the pages as they will get crawled automatically by google bot.
SO, hit the firebase api from php / curl and render the data in php itself and produce AMP pages.
If you render template on client using java-script there are chances your amp may not get cached by google completely.

Related

React : Get data from Google Analytics API

I'm creating an application using React and Laravel.
I integrated successfuly Google Analytics using this react-ga so when I check my Analytics dashboard the statistics of the pages of my project are there.
Now I want to display those data in my application to the users.
I've searched alot and I found that I need to use Embed API. The problem here is that it request an authentification each time a user want to access to the data. Searched some more and the solution was apparently to setup a service account as a user in Google Analytics.
Now that I have the account set, the API key generated, I don't know how to call the data from the server to my application.
There is this guide for javascript but I had a hard time implementing in React.

how to set multi paged website using firebase?

i'm working on a basic website using html/css/js and Firebase fire-store to store data along with authentication to authenticate users, my website consists of multiple HTML pages which most of utilise Firebase services, and i'm wondering what would be the best way to allow all the pages (and the scripts within them) to utilise the Firebase?
should i copy the Firebase SDK and configuration code snippet into each and every html page? i believe this wouldn't be a good practice and i doubt it would even work well..
how can i achieve what i want? is there a certain Firebase service that allows me to achieve it?
Firebase comes with a JavaScript SDK for Firestore, that you can use in your scenario.
The most common way to set up such a web app is as a single-page application, so that all HTML, JavaScript and CSS is loaded into a single page without ever reloading an entirely new page. This has the big advantage that you're only loading the Firebase SDKs once.
If you have multiple HTML pages, you will have to load Firebase into each page where you use it. But on all but the first page the SDK will likely be loaded from the user's browser cache, but it'll still be a lesser experience than with a single-page application.
For a good introduction of a single-page application, I recommend taking the Cloud Firestore for web developers codelab. As a more introductory tutorial to building single-page applications with Firebase and Firestore, I'd recommend Get to know Firebase for web and its companion video.

Dynamic Data in Shopify Blog Page

I want to write an API, i.e. hosted at www.api.mywebsite.com (not affiliated with Shopify) and then have a shopify blog post that queries that API and displays that data using javascript.
I know how to do the API potion, but can I and if so how do I do the second part where I use JS to query and display data?
Simple! Add an App Proxy to your App. With that, you setup an end point to call in your App. On the blog page you can send an Ajax GET with an ID to your App, which can then get dynamic content ready for you to use. You can either format the response as Liquid or as JSON as two examples. Send back Liquid, and Shopify renders it for you. Send back JSON and you can stamp out your data in a template.
And best of all it is a secure callback to your App that you know came from Shopify, so you have no hassles or security problems. Look in your App for Extensions, and enable Online Store, where you can tinker with the Proxy.

Uploading to Google Cloud via an asp.net webpage

I have a webpage through which my users, using a mobile phone, can take pictures and upload them (hopefully) to the Google Cloud (I've got a JSON file, a platform project and an associated storage bucket, as well as all the login details).
However, I'm pretty new to all this and need to know how I'd get the file (coming from a standard <input file="" name="fileupload"/> ) to the Google Cloud space, and also to retrieve the URI of the file. Given that it's an asp.net webpage, I have access to Javascript and C#.
Thanks!
I have a couple of suggestions for you. We have other customers that have solutions which are similar to this architecture and so your proposed solution is good.
Google Cloud Storage (GCS) has a feature called Signed URLs. This allows you to generate a secure URL to an object in a GCS bucket. My colleague wrote the C# sample for this:
https://cloud.google.com/storage/docs/access-control#signing-code-csharp
There's a method in here that you can reuse GetSigningURL.
Each time a user requests the web page, you should generate a Signed URL and use this as the destination URL for the file upload location in your HTML.
If your HTML is generated by ASP.NET (MVC, Web Forms, Web Page), then you can make the call to GetSigningURL when the page is generated server-side. If not, you should wrap the C# code in a Web API and then you could use, e.g. jQuery ($.ajax), to call it from your client.
You may run your ASP.NET code on Google Cloud Platform using either Windows on Google Compute Engine or using Custom Runtimes on Google App Engine.
Full disclosure: I'm a Googler working in cloud as a Strategic Customer Engineer.

Embed Google Analytics in Laravel

I set up a website with laravel 4.
The website has no front facing site ...
The website sends a file as response to a link earlier generated.
So there is no html / blade template.
How can I embed Google Analytics within Laravel without using html output?
Is there a chance to call the Google Analytics JavaScript with php?
Thanks
The Google Analytics Measurement Protocol is what you're looking for:
https://developers.google.com/analytics/devguides/collection/protocol/
It allows you to send hits directly to Google Analytics via simple HTTP requests, which you should easily be able to do from your PHP back-end.

Categories

Resources