Would like to see example "HTML Snippet" from Google Adsense API - html

Google Adsnse has an API that you can use (if you qualify) to generate Adsense ads on your site. The core feature is the function generateAdCode that returns "an HTML snippet that can be dropped into an HTML page for the page to start receiving Google Ads."
Try as hard as I could, I couldn't find a basic example of what that returned "HTML snippet" will look like.
Can anyone please enlighten me?
(Of course, I can make some strong assumptions, but I rather see something more definite.)
FYI, I am simply trying to understand the intricacies of using Google Adsense from all the different angles.
Thanks!

What they mean by HTML snippet is actually a JavaScript snippet which in turn generates HTML. Just visit any page with Google Ads on it and check out the (rendered) source code to see what Google Adsense publishes on your site.

Related

Advice Needed -- Converting to IFRAME google apps Script

I am stuck on converting my web app to IFRAME. I have stripped the code back as much as i can and the script itself works to a point.
The issue i am having is when it was running in NATIVE, it would return some html once complete, now it gets to that point and just sits there although it has done everything correctly to that point.
I am new to this and not sure if i should post code or a link to the web app but any help would be gratefully received.
Link to web app
https://docs.google.com/spreadsheets/d/1hXdgqwKAfbouV5CHo4wLJTpbP_d6TLIANlsU1Fvv0xk/edit?usp=sharing
You can create an iframe with the link in src attribute.
HTML
<iframe src="https://docs.google.com/spreadsheets/d/1hXdgqwKAfbouV5CHo4wLJTpbP_d6TLIANlsU1Fvv0xk/edit#gid=703430807">
</iframe>
This code can you include in your website. Let me know if this is what you want.
See this fiddle

Google Sites Drawing Reload

Total noob here with almost zero understanding of Google Apps Script or coding in general.
I was looking for a way to force a reload of a google sites page. This (reload page google apps script) makes it look like that can't be done, so I want to try and reload just the google drawing embedded in the site if possible.
I tried to use a javascript iFrame reload:
window.setInterval("reloadIFrame();", 30000); function reloadIFrame() { document.frames["frameNameHere"].location.reload(); }
But I don't think google sites supports this our I got it wrong somewhere.
I can't figure out what the correct Apps Script would be to force the page to reload(pull from the server) the drawing in question. The code for the drawing looks like this:
img
src="https://www.google.com/chart?chc=sites&cht=d&chdp=sites&chl=%5B%5BGoogle+drawing'%3D20'f%5Cv'a%5C%3D0'10'%3D999'0'dim'%5Cbox1'b%5CF6F6F6'fC%5CF6F6F6'eC%5C0'sk'%5C%5B%2211.30.15%22'%5D'a%5CV%5C%3D12'f%5C%5DV%5Cta%5C%3D10'%3D0'%3D1000'%3D347'dim'%5C%3D10'%3D10'%3D1000'%3D347'vdim'%5Cbox1'b%5Cva%5CF6F6F6'fC%5CC8C8C8'eC%5C'a%5C%5Do%5CLauto'f%5C&sig=0bBZl8MyZOx5b3ykHuUS35Gb8iE"
data-origsrc="1mUFhZeas0mFl52FpqC_EgflRn6P3TixsOxMAXI-_Fgo"
data-type="sketchy"
data-props="align:left;borderTitle:11.30.15;height:350;objectTitle:11.30.15;showBorder:false;showBorderTitle:false;width:1000;wrap:false;" width="1000" height="350"
style="display:block;text-align:left;margin-right:auto;">
It's located in my google drive and I just used the google sites tools to embed it, I didn't code it. The drawing is edited constantly throughout the day and I need the changes to appear while viewing with out requiring a page refresh.
Can anyone help me with where and what code could be used to reload the drawing? Even better would be if I could set an interval (say every 5 minutes) for the refresh. Any help is appreciated.
Thanks
Probably you can create an XML gadget that reloads the Google Sites Page.
Try this one (found quickly)
http://www.k8oms.net/refresh

Google Charts Trendline: can I draw it in URL

I am using google charts to describe the datas. And I would like to show it in URL, which will be much easier to be added to a web page.
However, the official tutorial just tells me how to do it in HTML. So can I do it in URL (showing an image)? Thanks.

Is there an example of how to add Replace to Google Docs

Is there an example anywhere of how to use the Document apps-script API to add a button to the Google Docs menu, when it is clicked bring up a web page from my web app that prompts the user for 2 strings, then on OK it does a search & replace on the open document?
I don't need to add search/replace per-se. I just figure this is the simplest example of writing an Add-In to Google Docs that edits the open document.
thanks - dave
As it stands, this is not possible. I think this issue (which you might like to star so that you can receive updates in the thread) best describes it. Summary in post #7:
This feature request is to add the same script functionality to a
document as there is in a spreadsheet. ie menu items etc.
A recent video by google (see their blogs) hints that this will be soon available.
In the meantime u can ask for the document url from your published script interface.
If you make a googledrive.com client app you can even use the new goglepicker to select the doc.

Safari Extension : retrieve full HTML code from a page

i'm trying to create a safari extension and i'm stuck with something.
I have my global.html on my extension and i've been searching the web for like 3hours on how to retrieve the full html code without success.
I tried:
document.getElementsByTagName('html')[0].innerHTML (when i alert i only see the code that i have inside my global.html)
document.documentElement.innerHTML (nothing happens)
etc...
I used safari.application.activeBrowserWindow.activeTab.url to retrieve the url but i cant get the html code.
Any help?
Thank you
You can't get the HTML of a web page from your extension's global page. You have to use an injected script and then, if you want, you can pass the web page's HTML to your global page using safari.self.tab.dispatchMessage. See this chapter in Apple's documentation.