How to embed live Google Sheets data into Google Sites - javascript

I need to embed Google Sheet data into a Google site. This is easy to do for static data, but not for live, changing, dynamic data in the Sheet. I need the Google site to automatically refresh in realtime for any change made on the Google Sheet.
I have tried using the automatic refresh/publish checkbox on Google Sheets. This will make the data available to the Google site, but the Google site does not automatically update unless the page is refreshed.
I expect one user to add information to a cell in Google Sheets, and in realtime the embedded sheet data on the Google site would reflect that change. However, what actually happens is the cell is changed in Google Sheets, then the Google site has to be refreshed manually in order to display the changed cell.

There is a way, but automatically updating content every 5 minutes (I ignore if the frequency can be changed).
You have to go to Gsheet > File > Publish to Web.
From there you grab the link and publish.
Then, you go to Google sites > Insert > Embed. Choose URL, paste link grabbed before.
Hope that helps!

That's actually not an issue from Google Sheet. It depends on how often does your site clears its cache for the updates. You should set that up within your admin panel if you have. Example, for wordpress users we tend to have a caching plugin to do the job.

Related

How to get value from clipboard in App Script

I read in the past that Google does not allow copying values into clipboard but can it at least copy data from clipboard? If there is a way, what would the script look like as I have no clue.
I have a spreadsheet where users copy 2-3 lines of data (Address) from external source (Email or PDF) and then paste that date into multiple cells on the spreadsheet. Users usually have to copy-paste the street1, street2, zip code, state etc. into different cells.
I am trying to create a script where users just need to select address1 cell and then call on the script to get value from clipboard and auto-distribute it to their expected cells. Is this possible?
This is possible with the sidebar on supported browsers, if Google allows clipboard-read permission on the sandboxed iframe. There's a feature request already made:
https://issuetracker.google.com/issues/179172852
Add a +1 to the tracker and comment on how it'll be useful from a business cost point of view, if you want this implemented. Writing to clipboard, however is possible in most browsers without permission.
Related:
Can text within an iframe be copied to clipboard?
Add content of showModalDialog() to the clipboard Google Script
Clipboard manipulation on Google Apps?
Automating the new Google Sites via the Clipboard
Where is my iframe in the published web application/sidebar?
Documentation:
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-allow
https://developer.mozilla.org/en-US/docs/Web/API/Clipboard

Use Google Apps Script to fill out a PDF form saved on my Google Drive

I have this built in Excel, but struggling to transition it to Google Sheets. I have customer information in a Sheet (name, address, services...) and a PDF which needs to be filled from this information. I saw suggestions to use DocHub, but that doesn't seem to get me there, and I need the rest of the formatting and data in the PDF, not just outputting or printing the sheet as a PDF.
So: PDF is in my Google Drive. It has editable fields. I want to fill those fields with specified data from my Google Sheet.
I'm OK with it being a script that I modify (I do a lot of scripting) or a MailMerge or an add-on or any other method.
Take a look at the PDFFiller API or something similar. Alternatively PDFFiller have a GSheets Add-on you can use to complete a PDF template.

How can I get page timings for a SPA in Google Analytics using GTM?

I've been wresteling with this a few days and can't really find any good information on it. I am a novice with respect to Google Analytics and Google Tag Manager.
I have a client website which is a Single Page Application using Marionette. The client would like timings on how long it takes to load different pages in the application, specifically they want to know what pages to focus on for optimizations. They also want more analysis on user interaction in GA.
I've installed the google tag manager and setup the page view tag to show the individual page paths via the History trigger properly as described here:
https://www.pmg.com/blog/tracking-single-page-web-apps-google-tag-manager-analytics/
That is working fine, I can see the history fragments/page paths in GA.
The problem is when I go to Page Timings in the Behavior reports in GA all the timings are 0. Avg page load, server load, etc.
I've tried installing a page timing recipe from Luna Metrics:
https://www.lunametrics.com/labs/recipes/page-load-timing/
This did not work as the custom javascript in it depended on window.performance which after some research does not appear to work well for SPAs.
function() {
var timing = window.performance.timing;
var ms = timing.loadEventStart - timing.navigationStart;
return Math.round(ms / 100) / 10;
}
I've also tried setting the siteSpeedSampleRate to 100 in the PageView tag for google analytics. This appears to have had no affect either.
i've also been messing with the tags and using the GTM preview and GA Debug and I can see the custom timings being set but with the same value on every subsequent link click (Its using the same page load value on the initial page load I think) which is why I don't think window.performance is an option here.
I've not been able to find any definitive way to get google analytics to track page timings for an SPA and would love any suggestions!
I guess I just needed to be a little patient after the siteSpeedSampleRate change. That seems to have resolved the timing issues for me.

Artificial pageview pushed to Analytics is changing PPC traffic source

So basically, we are having issues with a website (https://thesoundshop.com) in which the PPC traffic source (it only seems to be PPC traffic that is affected) is being changed by the pageview that we are pushing through to analtics.
The website runs on Ajax so we have to use Javascript to emulate pageviews through to Analytics whenever a link is clicked on the website. We are not using Google Tag Manager to implement the analytics or javascript because of this so we are using the gtag method exactly as Google's documentation recommends:
gtag('config', 'GA_TRACKING_ID');
I have tested this by visiting the website through a PPC ad and watching the real-time reports in Analytics. The first page load attributes the correct source to the traffic (cpc) as expected but then when I click on a link to go to a different page, the traffic source changes to Google Organic search. I then complete an action that I know will trigger an event or a goal and then when this appears in the Goal Reports, it attributes the goal as organic, too.
We know that this has to be down to the Javascript pageview that is being pushed to analytics to simulate that a new page has loaded but we can't work out why it would be changing the traffic source. The gtags are implemented exactly as Google recommends; just wondering if anyone else has had this problem and if so, how did they go about fixing it?
We had the same issue and after some more research found the problem along with the solution, thanks to Simo.
Basically, you need to manually set the document.referrer of the first session to make sure it persists and does not get over-written half way through the session. It's a known issue with GTM and single page applications.

How to display a webpage in a html page from an url?

I want to display 2 webpages in single aspx webpage is it possible ?
for example
user -- open link for www.mywebsite.com
In my homepage i want to display both www.google.com and www.bing.com.
In the background i call two different url's and they should display on my same aspx page.
To integrate websites in other websites use an iframe like this:
<iframe src="http://www.bing.com"></iframe>
More information: w3schools
Google
This will not work for google because of their therms and services:
1.3 Your Obligations. You shall receive a Query from the End User and shall forward that Query to Google. You maynot in any way frame, cache or modify the Results produced by Google, except as otherwise agreed to between You and Google.
So if you want to integrate Google search to your website, you can read more about the API here Google Api
Bing
To embend searchresults from bing take a look at the Bing api. 5000 queries per day are free.

Categories