Skip to content
function getResults() {
var connector = {'username':'YOUR_SITE_USERNAME',
'password':'YOUR_SITE_PASSWORD',
'connectorDomain':'YOUR_CONNECTOR_DOMAIN',
'userGuid':'YOUR_USER_GUID',
'connectorGuid':'YOUR_CONNECTOR_GUID',
'apiKey':'YOUR_API_KEY'}
var creds = {};
creds[connector.connectorDomain] = {
// Copyright 2015 Martin Hawksey. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
var BASE_URL = 'https://sites.google.com/a/hawksey.info/sandbox/mozilla-open-badges-issuer-example'; // Google Sites page
// for script to handle issuing badges see https://script.google.com/d/1wOxT8VA2mhPVR4b4v7jMTOiIa3hNkUJyAcHUzUh6sObSITyOu3wKi4NS/edit?usp=sharing
/**
* Handle form submit
*/
function onSubmit(e) {
var doc = SpreadsheetApp.getActiveSpreadsheet();
var sheet = doc.getSheetByName("IssuedBadges"); // note: assumed sheet name
var email = e.namedValues['Email'][0]; // note: assumed question name with person's email address
var uid = getUID();
{
"recipient":{
"type":"email",
"hashed":true,
"salt":"MASHeHawk53yBl0g",
"identity":"sha256$7da5d01955b57cdefd04994e98e68541e4f1c9f99ac3308d5f14485c60ac0e8f"
},
"image":"https://dl.dropboxusercontent.com/u/7860124/ALT-Survey-Badge-2014.png",
"badge":"https://script.google.com/macros/s/AKfycbx5uvVcmmHweZwhIxzO0IAUrUtY_cW88Sz1B-MpquZxopvfyIY/exec?type=badge",
"verify":{
function sendEmail(e) {
var emailTo = e.namedValues['20. Email confirmation (and badge)'][0];
if (emailTo != ""){
var text = 'Thank you for taking time to complete the ALT Annual Survey 2014. You can help us get a better understanding of how learning technology is used across sectors by sharing this link to the survey with your community: http://go.alt.ac.uk/ALT-Survey-2014\n\nYou might also use this suggested text in a tweet:\n\n " Just completed the ALT Annual Survey 2014 exploring use of learning technology across sectors. Have your say http://go.alt.ac.uk/ALT-Survey-2014 #altc "';
var textHtml = HtmlService.createHtmlOutputFromFile('mailText').getContent();
MailApp.sendEmail(emailTo,
"Thank you for completing the ALT Annual Survey 2014",
text,
{replyTo:"enquiries@alt.ac.uk", htmlBody: textHtml});
}
Remote Address:74.125.230.68:443
Request URL:https://script.google.com/macros/s/AKfycbx5uvVcmmHweZwhIxzO0IAUrUtY_cW88Sz1B-MpquZxopvfyIY/exec?type=assertion&uid=54354354354-2
Request Method:GET
Status Code:302 Moved Temporarily
Request Headers
Provisional headers are shown
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
User-Agent:Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.38 Safari/537.36
Query String Parametersview sourceview URL encoded
type:assertion
// this function handles the form submit
function addVideoToPlaylist(e){
// 'Youtube url' is the question title from our form. If you change your question change this value
// youtube_parser() takes the url and strips the video_id
var id = youtube_parser(e.namedValues['Youtube url'][0]);
var desc = e.namedValues['Comment'][0]; // if you would like to add a note with playlist item add form field
addToPlaylist(id, desc);
}
// This function is taken from the YouTube API doc (Javascript example)
// Copyright 2014 Martin Hawksey. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// instead of var results = YouTubeAnalytics.Reports.query(ids, start-date, end-date, metrics, optionalArgs);
var params = {"method" : "post",
"payload" : {'ids' : query.ids,
"startDate" : startDate,
"endDate": endDate,
"metrics": query.metrics,
"options": JSON.stringify(options)
}
};
var yt_data = UrlFetchApp.fetch("https://script.google.com/macros/s/YOUR_APP_ID/exec", params);
function fetchMyQuery() {
// our query object
var query = {
"optionalArgs": {
"dimensions": "ga:source",
"filters": "ga:medium==referral",
"sort": "-ga:pageviews",
"max-results": "50"
},
"ids": "ga:82426939",
Something went wrong with that request. Please try again.