You are here

Code

Custom Google Analytics tracking code.

paulbooker's picture
Submitted by paulbooker on Thu, 07/27/2017 - 11:04

/**
 * @file
 * Custom Google Analytics tracking code.
 */
(function ($) {
  Drupal.behaviors.sc_analytics = {
    attach: function (context, settings) {

      // Register AddThis event listener.
      $(document).ready(function() {
        if (typeof(addthis) != 'undefined') {
          addthis.addEventListener('addthis.menu.share', addthisEventHandler);
        }
      });

      // AddThis.
      function addthisEventHandler(e) {
        ga('send', 'event', 'AddThis', e.data.service, e.data.url);
      }

      // After pressing 'Confirm and Pay' on the Donate Now confiration screen.
      $('#sc-donations-donation-confirmation-form #edit-submit').click(function() {
        ga('send', 'event', 'Online donation', 'submit', 'donate-now');
      });

      // Contact form submit.
      $('#webform-client-form-1').submit(function() {
        ga('send', 'event', 'Contact form submission', 'submit', 'contact-us');
      });

      // Book event.
      $('.button-book-event').click(function() {
        ga('send', 'event', 'Book event', 'submit', location.pathname);
      });

      // Events RSS.
      $('#events-rss').click(function() {
        ga('send', 'event', 'Events RSS', 'click', location.pathname);
      });

      // News RSS.
      $('#news-rss, #blog-rss').click(function() {
        ga('send', 'event', 'News RSS', 'click', location.pathname);
      });

      // Audio files.
      $('.audio-file-link').click(function() {
        ga('send', 'event', 'Audio file play', 'click', $(this).attr('href'));
      });


        // Menu
      // About Us
        
      $('.sf-menu #menu-885-1 a.sf-depth-1').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'About Us' );
      });
      
      $('.sf-menu #menu-1137-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'About Us | Welcome' );
      });
      
      $('.sf-menu #menu-1152-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'About Us | Our Purpose and Values' );
      });
      
      $('.sf-menu #menu-1160-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'About Us | Governance' );
      });
      
      $('.sf-menu #menu-1037-1 a.sf-depth-3').click(function() {
	      ga('send', 'event', 'Menu', 'Main Menu', 'About Us | Governance | Chapter' );   
      });
       
      $('.sf-menu #menu-1161-1 a.sf-depth-3').click(function() {
	      ga('send', 'event', 'Menu', 'Main Menu', 'About Us | Governance | College of Cannons' );   
      });    

      $('.sf-menu #menu-1162-1 a.sf-depth-3').click(function() {
	      ga('send', 'event', 'Menu', 'Main Menu', 'About Us | Governance | Cathedral Council' );   
      }); 
      
      $('.sf-menu #menu-1163-1 a.sf-depth-3').click(function() {
	      ga('send', 'event', 'Menu', 'Main Menu', 'About Us | Governance | Annual Review and Accounts' );   
      });   
      
      $('.sf-menu #menu-1154-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'About Us | Our People' );
      }); 
      
      $('.sf-menu #menu-1957-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'About Us | Master Plan' );
      }); 
      
      $('.sf-menu #menu-2927-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'About Us | Safeguarding' );
      }); 
      
      $('.sf-menu #menu-1155-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'About Us | Supporting Others' );
      }); 
      
      $('.sf-menu #menu-1166-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'About Us | Supporting Others | Charitable Giving' );
      }); 
      
      $('.sf-menu #menu-1167-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'About Us | Supporting Others | Amnesty International' );
      }); 
      
      $('.sf-menu #menu-1169-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'About Us | Supporting Others | Churches Together' );
      }); 
      
      $('.sf-menu #menu-1168-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'About Us | Supporting Others | Sudan Link' );
      }); 
      
      $('.sf-menu #menu-1158-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'About Us | Venue Use and Hire' );
      }); 

   		$('.sf-menu #menu-1185-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'About Us | Community Forum' );
      });    
      
			$('.sf-menu #menu-1156-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'About Us | Work for Us' );
      });    
      
      // Menu
      // Worship & Music
      
      $('.sf-menu #menu-682-1 a.sf-depth-1').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Worship & Music' );
      });
      
      $('.sf-menu #menu-1953-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Worship & Music | Sermons & Reflections' );
      });

      $('.sf-menu #menu-1293-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Worship & Music | Sermons & Reflections | Music Schemes' );
      });      
      
      $('.sf-menu #menu-1294-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Worship & Music | Sermons & Reflections | Sunday Notices' );
      }); 
      
      $('.sf-menu #menu-1093-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Worship & Music | Liturgy at Salisbury' );
      });      
 
      $('.sf-menu #menu-1202-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Worship & Music | Liturgy at Salisbury | Precentor' );
      });      
      
      $('.sf-menu #menu-1203-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Worship & Music | Liturgy at Salisbury | Vestry' );
      });
      
      $('.sf-menu #menu-1087-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Worship & Music | Department of Liturgy & Music' );
      });

      $('.sf-menu #menu-1123-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Worship & Music | Department of Liturgy & Music | Director of Music' );
      });            

      $('.sf-menu #menu-1124-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Worship & Music | Department of Liturgy & Music | Assistant Director of Music' );
      });  
      
      $('.sf-menu #menu-1125-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Worship & Music | Department of Liturgy & Music | Organ Scholar' );
      });        

      $('.sf-menu #menu-1213-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Worship & Music | Choirs' );
      });    

      $('.sf-menu #menu-1750-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Worship & Music | Choirs | Listen Online' );
      });        

      $('.sf-menu #menu-1747-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Worship & Music | Choirs | Cathedral Choir' );
      });        
      
      $('.sf-menu #menu-1181-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Worship & Music | Choirs | Cathedral Junior Choir' );
      }); 
      
      $('.sf-menu#menu-1092-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Worship & Music | Choirs | Cathedral Chamber Choir' );
      }); 

      $('.sf-menu #menu-1186-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Worship & Music | Choirs | Visiting Choirs' );
      });       

      $('.sf-menu #menu-1183-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Worship & Music | Choirs | Choir Recruitment' );
      });       
             
      $('.sf-menu #menu-1182-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Worship & Music | Choirs | Diocesan Visits' );
      });   
      
      $('.sf-menu #menu-1094-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Worship & Music | Organs' );
      });    
            
      $('.sf-menu #menu-1299-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Worship & Music | Organs | Father Willis Organs' );
      });        

      $('.sf-menu #menu-1297-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Worship & Music | Organs | History' );
      });                                 

      $('.sf-menu #menu-2085-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Worship & Music | Organs | Organ Recitals' );
      });   

      $('.sf-menu #menu-1179-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Worship & Music | Join the Congregation' );
      });  
      
      $('.sf-menu #menu-1180-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Worship & Music | Join the Congregation | Sunday Club' );
      });  

      $('.sf-menu #menu-1112-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Worship & Music | Prayer Request' );
      });  
      
      // Menu
      // Visit
      
      $('.sf-menu #menu-685-1 a.sf-depth-1').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit' );
      });
 
      $('.sf-menu #menu-1216-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | What to See' );
      });
      
      $('.sf-menu #menu-1267-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | What to See | Floor Plan' );
      });         

      $('.sf-menu #menu-1286-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | What to See | Virtual Tour' );
      });
      
      $('.sf-menu #menu-1369-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | What to See | Salisbury Cathedral Spire' );
      }); 

      $('.sf-menu #menu-1951-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | What to See | Magna Carta Exhibition' );
      });                              

      $('.sf-menu #menu-1367-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | What to See | Prisoners of Conscience Windows' );
      });   

      $('.sf-menu #menu-1384-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | What to See | Rex Whistler Memorial Prism' );
      }); 

      $('.sf-menu #menu-1368-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | What to See | Cathedral Font' );
      });       

      $('.sf-menu #menu-1324-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | What to See | Medieval Clock' );
      });   

      $('.sf-menu #menu-1270-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | What to See | The Close' );
      });         
      
      $('.sf-menu #menu-1956-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | What to See | Peregrin Falcons' );
      }); 
      
      $('.sf-menu #menu-1017-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | Plan your Visit' );
      });        

      $('.sf-menu #menu-1272-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | Plan your Visit | Closures' );
      });         

      $('.sf-menu #menu-872-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | Plan your Visit | Getting Here' );
      }); 
                  
      $('.sf-menu #menu-1271-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | Plan your Visit | Visiting Times' );
      }); 

      $('.sf-menu #menu-1273-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | Plan your Visit | Recommended Donations' );
      }); 
      
      $('.sf-menu #menu-1269-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | Plan your Visit | Floor Tours and Guides' );
      }); 

      $('.sf-menu #menu-1276-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | Plan your Visit | Family Visits and Pets' );
      });       

      $('.sf-menu #menu-2366-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | Plan your Visit | Accommodation' );
      });  

      $('.sf-menu #menu-1275-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | Plan your Visit | Accessibility' );
      });        

      $('.sf-menu #menu-1274-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | Plan your Visit | Stonehenge' );
      });   

      $('.sf-menu #menu-1371-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | Plan your Visit | Salisbury and Surrounds' );
      });  
      
      $('.sf-menu #menu-865-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | Tower Tours' );
      });

      $('.sf-menu #menu-866-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | Tower Tours | Book a Tower Tour' );
      }); 
      
			$('.sf-menu #menu-1113-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | Food and Drink' );
      });     

			$('.sf-menu #menu-2064-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | Food and Drink | The Refectory' );
      });                 

			$('.sf-menu #menu-2065-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | Food and Drink | Bell Tower Tea Rooms' );
      });  

			$('.sf-menu #menu-1174-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | Food and Drink | Its all about the Food' );
      }); 
      
			$('.sf-menu #menu-1176-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | Food and Drink | Speciality Teas and Coffees' );
      })            

			$('.sf-menu #menu-1177-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | Food and Drink | Customer Feedback' );
      })    

			$('.sf-menu #menu-1178-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | Food and Drink | Private Function and Venue Hire' );
      })       

			$('.sf-menu #menu-1215-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | Food and Drink | What we Care About' );
      })  

			$('.sf-menu #menu-1568-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | Food and Drink | The Team Behind the Scenes' );
      })  
      
			$('.sf-menu #menu-1205-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | Groups and Travel Trade' );
      });
      
      $('.sf-menu #menu-1206-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | Groups and Travel Trade | Day Packages' );
      });        

      $('.sf-menu #menu-1207-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | Groups and Travel Trade | Group Refreshment Packages' );
      });                          

      $('.sf-menu #menu-1208-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | Groups and Travel Trade | Special Event for Groups' );
      }); 

      $('.sf-menu #menu-1210-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | Groups and Travel Trade | Language Schools' );
      });       

      $('.sf-menu #menu-1211-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | Groups and Travel Trade | Other Places to Visit' );
      });  
      
      $('.sf-menu #menu-1212-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | Groups and Travel Trade | Group Booking Form' );
      });  

      $('.sf-menu #menu-1282-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | Groups and Travel Trade | Travel Trade Resource' );
      }); 

			$('.sf-menu #menu-1257-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | Art at the Cathedral' );
      });       

			$('.sf-menu #menu-1250-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | Literary and Film Links' );
      });    
      
			$('.sf-menu #menu-1277-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | Gift Shop' );
      });    

			$('.sf-menu #menu-1260-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Visit | FAQ for Visitors' );
      }); 
      
      
      // Menu
      // Events & Services
      
      $('.sf-menu #menu-3033-1 a.sf-depth-1').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Events & Services' );
      });   
          

      // Menu
      // News & Views
      
      $('.sf-menu #menu-688-1 a.sf-depth-1').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'News & Views' );
      });    
      
      $('.sf-menu #menu-689-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'News & Views | News' );
      });   

      $('.sf-menu #menu-690-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'News & Views | Blog' );
      });                    

      $('.sf-menu #menu-691-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'News & Views | Multimedia Gallery' );
      });                                                                               

      $('.sf-menu #menu-693-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'News & Views | Cathedral News Magazine' );
      }); 
      
      
      // Menu
      // History
      
      $('.sf-menu #menu-695-1 a.sf-depth-1').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'History' );
      });    
      
      $('.sf-menu #menu-1228-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'History | A New Start - Building the Cathedral' );
      });    
      
      $('.sf-menu #menu-1234-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'History | The Sarum Rite' );
      });           

      $('.sf-menu #menu-1229-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'History | Adding the Spire' );
      });  

      $('.sf-menu #menu-1227-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'History | Medieval Unrest' );
      });        
      
      $('.sf-menu #menu-1230-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'History | Reformation' );
      });        

      $('.sf-menu #menu-1231-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'History | Civil War & Restoration' );
      });       

      $('.sf-menu #menu-1232-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'History | Eighteenth Century repair and Wyatt' );
      });     

      $('.sf-menu #menu-1233-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'History | Reordering and Glibert Scott' );
      });        

      $('.sf-menu #menu-1235-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'History | Twentieth Century and Major Repair' );
      });  
 
      $('.sf-menu #menu-2362-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'History | Published Histories' );
      });       

      $('.sf-menu #menu-2361-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'History | Sir Christopher Wren' );
      });  
      
      // Menu
      // Magna Carta
      
      $('.sf-menu #menu-699-1 a.sf-depth-1').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Magna Carta' );
      });   
      
      $('.sf-menu #menu-1217-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Magna Carta | What is Magna Carta?' );
      });         
      
      $('.sf-menu #menu-1222-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Magna Carta | What is Magna Carta? | Why was it Written' );
      });         

      $('.sf-menu #menu-1223-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Magna Carta | What is Magna Carta? | The Document' );
      });         
           
      $('.sf-menu #menu-1015-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Magna Carta | What is Magna Carta? | The Salisbury Collection' );
      }); 

      $('.sf-menu #menu-1224-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Magna Carta | What is Magna Carta? | Further Reading and References' );
      }); 

      $('.sf-menu #menu-2077-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Magna Carta | What is Magna Carta? | Key Clauses' );
      }); 
      
      $('.sf-menu #menu-1219-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Magna Carta | Magna Carta Today' );
      });         

      $('.sf-menu #menu-1220-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Magna Carta | Magna Carta Today | Supporting Social Justice' );
      });    

      $('.sf-menu #menu-1225-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Magna Carta | Magna Carta Today | Magna Carta and Jay-Z' );
      });  
      
      $('.sf-menu #menu-1218-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Magna Carta | Visiting Magna Carta' );
      });      
      
      $('.sf-menu #menu-1372-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Magna Carta | Magna Carta for Schools' );
      });                                 
             
      $('.sf-menu #menu-2084-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Magna Carta | Magna Carta for Schools | Tales of Magna Carta' );
      });                              

      $('.sf-menu #menu-1221-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Magna Carta | 800 anniversary celebrations 2015' );
      });  
      
      // Menu
      // Conservation & Restoration
      
      $('.sf-menu #menu-894-1 a.sf-depth-1').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Conservation & Restoration' );
      });   

      $('.sf-menu #menu-891-1 a.sf-depth-1').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Conservation & Restoration | Major Repair Programme' );
      });        

      $('.sf-menu #menu-1139-1 a.sf-depth-1').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Conservation & Restoration | Our Works Department' );
      }); 

      $('.sf-menu #menu-1144-1 a.sf-depth-1').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Conservation & Restoration | Follow our Progress' );
      }); 
      
      // Menu
      // Learning
      $('.sf-menu #menu-1100-1 a.sf-depth-1').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Learning' );
      });   

      $('.sf-menu #menu-1019-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Learning | Education Programmes' );
      });               

      $('.sf-menu #menu-1188-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Learning | Education Programmes | Key Stage Programmes' );
      }); 

      $('.sf-menu #menu-1190-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Learning | Education Programmes | Higher and Further Educations' );
      });                                                                   

      $('.sf-menu #menu-1192-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Learning | Education Programmes | Educational Resources' );
      });  

      $('.sf-menu #menu-1193-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Learning | Education Programmes | Off-site Visits' );
      });  

      $('.sf-menu #menu-1204-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Learning | Education Programmes | Regular School Events' );
      });  

      $('.sf-menu #menu-1194-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Learning | Education Programmes | Magna Carta Education' );
      }); 
      
      $('.sf-menu #menu-1103-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Learning | Information for Visits' );
      });               
      
      $('.sf-menu #menu-1187-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Learning | Community Outreach' );
      });               

      $('.sf-menu #menu-1196-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Learning | Community Outreach | Outreach Projects' );
      });         

      $('.sf-menu #menu-941-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Learning | Family Activities' );
      });  

      $('.sf-menu #menu-1197-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Learning | Family Activities | Holiday Activities' );
      });        
      
      $('.sf-menu #menu-922-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Learning | Adult Learning' );
      }); 
      
      $('.sf-menu #menu-1198-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Learning | Adult Learning | Congregation' );
      }); 
      
      $('.sf-menu #menu-1570-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Learning | Archive' );
      });  

      $('.sf-menu #menu-2363-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Learning | Archive | Register of St Osmund' );
      }); 

      $('.sf-menu #menu-1570-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Library' );
      });  
      
      $('.sf-menu #menu-1748-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Library' );
      });  

      $('.sf-menu #menu-1749-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Library | History' );
      });     
      
      // Menu
      // Get Involved 
      
      $('.sf-menu #menu-696-1 a.sf-depth-1').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Get Involved' );
      });   
       
      $('.sf-menu #menu-1095-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Get Involved | Donate Now' );
      });

      $('.sf-menu #menu-1101-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Get Involved | Where your Money Goes' );
      });      

      $('.sf-menu #menu-1031-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Get Involved | Sponsor a Stone' );
      });               

      $('.sf-menu #menu-2075-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Get Involved | Sponsor a Chorister' );
      }); 
      
      $('.sf-menu #menu-2926-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Get Involved | Support our Art' );
      }); 

      $('.sf-menu #menu-1027-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Get Involved | Leave a Legacy' );
      });       

      $('.sf-menu #menu-1029-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Get Involved | Give as You Live' );
      }); 

      $('.sf-menu #menu-1038-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Get Involved | Volunteer for Us' );
      }); 
      
      $('.sf-menu #menu-2086-1 a.sf-depth-3').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Get Involved | Volunteer for Us | Volunteer Voice' );
      }); 
      
      $('.sf-menu #menu-1105-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Get Involved | Become a Friend' );
      }); 

      $('.sf-menu #menu-697-1 a.sf-depth-2').click(function() {
        ga('send', 'event', 'Menu', 'Main Menu', 'Get Involved | Keep in Touch' );
      });       
                                    
      // 2nd Menu
      
      $('.accordion-menu-1  .menu-mlid-1137 a').click(function() {
        ga('send', 'event', 'Menu', '2nd Menu', 'Welcome' );
      });
      
      $('.accordion-menu-1 .menu-mlid-1152 a').click(function() {
        ga('send', 'event', 'Menu', '2nd Menu', 'Our Purpose and Values' );
      });
        
      $('.accordion-menu-1 .menu-mlid-1160 a').click(function() {
        ga('send', 'event', 'Menu', '2nd Menu', 'Governance' );
      });
      
      $('.accordion-menu-1 .accordion-content-3 ul li:nth-child(1) a').click(function() {
        ga('send', 'event', 'Menu', '2nd Menu', 'Governance | Chapter' );
      });
      
      $('.accordion-menu-1 .accordion-content-3 ul li:nth-child(2) a').click(function() {
        ga('send', 'event', 'Menu', '2nd Menu', 'Governance | College of Cannons' );
      });

      $('.accordion-menu-1 .accordion-content-3 ul li:nth-child(3) a').click(function() {
        ga('send', 'event', 'Menu', '2nd Menu', 'Governance | Cathedral Council' );
      });      

      $('.accordion-menu-1 .accordion-content-3 ul li:nth-child(3) a').click(function() {
        ga('send', 'event', 'Menu', '2nd Menu', 'Governance | Annual Review and Accounts' );
      });   
      
      $('.accordion-menu-1 .menu-mlid-1154 a').click(function() {
        ga('send', 'event', 'Menu', '2nd Menu', 'Our People' );
      });     

      $('.accordion-menu-1 .menu-mlid-1957 a').click(function() {
        ga('send', 'event', 'Menu', '2nd Menu', 'Master Plan' );
      }); 

      $('.accordion-menu-1 .menu-mlid-2927 a').click(function() {
        ga('send', 'event', 'Menu', '2nd Menu', 'Safeguarding' );
      });       

      $('.accordion-menu-1 .menu-mlid-1155 a').click(function() {
        ga('send', 'event', 'Menu', '2nd Menu', 'Supporting Others' );
      });     
      
      $('.accordion-menu-1 .accordion-content-7 ul li:nth-child(1) a').click(function() {
        ga('send', 'event', 'Menu', '2nd Menu', 'Supporting Others | Charitable Giving' );
      });              

      $('.accordion-menu-1 .accordion-content-7 ul li:nth-child(2) a').click(function() {
        ga('send', 'event', 'Menu', '2nd Menu', 'Supporting Others | Amnesty International' );
      });       

      $('.accordion-menu-1 .accordion-content-7 ul li:nth-child(3) a').click(function() {
        ga('send', 'event', 'Menu', '2nd Menu', 'Supporting Others | Churches Together' );
      });          

      $('.accordion-menu-1 .accordion-content-7 ul li:nth-child(4) a').click(function() {
        ga('send', 'event', 'Menu', '2nd Menu', 'Supporting Others | sudan Link' );
      });          

      $('.accordion-menu-1 .menu-mlid-1158 a').click(function() {
        ga('send', 'event', 'Menu', '2nd Menu', 'Venue Use and Hire' );
      });   

      $('.accordion-menu-1 .menu-mlid-1185 a').click(function() {
        ga('send', 'event', 'Menu', '2nd Menu', 'Community Forum' );
      });         

      $('.accordion-menu-1 .menu-mlid-1156 a').click(function() {
        ga('send', 'event', 'Menu', '2nd Menu', 'Work for Us' );
      });       

      $('.accordion-menu-1 .menu-mlid-681 a').click(function() {
        ga('send', 'event', 'Menu', '2nd Menu', 'Contact Us' );
      });                  
      
      // 3rd Menu
      
      $('.menu-block-2 .menu-mlid-1137 a').click(function() {
        ga('send', 'event', 'Menu', '3rd Menu', 'About Us | Welcome' );
      });
      
      $('.menu-block-2 .menu-mlid-1152 a').click(function() {
        ga('send', 'event', 'Menu', '3rd Menu', 'About Us | Our Purpose and Values' );
      });
      
      $('.menu-block-2 .menu-mlid-1160 a').click(function() {
        ga('send', 'event', 'Menu', '3rd Menu', 'About Us | Governance' );
      });
      
      $('.menu-block-2 .menu-mlid-1037 a').click(function() {
	      ga('send', 'event', 'Menu', '3rd Menu', 'About Us | Governance | Chapter' );   
      });
       
      $('.menu-block-2 .menu-mlid-1161 a').click(function() {
	      ga('send', 'event', 'Menu', '3rd Menu', 'About Us | Governance | College of Cannons' );   
      });    

      $('.menu-block-2 .menu-mlid-1162 a').click(function() {
	      ga('send', 'event', 'Menu', '3rd Menu', 'About Us | Governance | Cathedral Council' );   
      }); 
      
      $('.menu-block-2 .menu-mlid-1163 a').click(function() {
	      ga('send', 'event', 'Menu', '3rd Menu', 'About Us | Governance | Annual Review and Accounts' );   
      });   
      
      $('.menu-block-2 .menu-mlid-1154 a').click(function() {
        ga('send', 'event', 'Menu', '3rd Menu', 'About Us | Our People' );
      }); 
      
      $('.menu-block-2 .menu-mlid-1957 a').click(function() {
        ga('send', 'event', 'Menu', '3rd Menu', 'About Us | Master Plan' );
      }); 
      
      $('.menu-block-2 .menu-mlid-2927 a').click(function() {
        ga('send', 'event', 'Menu', '2nd Menu', 'Safeguarding' );
      });
            
      $('.menu-block-2 .menu-mlid-1155 a').click(function() {
        ga('send', 'event', 'Menu', '2nd Menu', 'Supporting Others' );
      }); 
      
      $('.menu-block-2 .menu-mlid-1158 a').click(function() {
        ga('send', 'event', 'Menu', '2nd Menu', 'Venue Use and Hire' );
      });   

      $('.menu-block-2 .menu-mlid-1185 a').click(function() {
        ga('send', 'event', 'Menu', '2nd Menu', 'Community Forum' );
      });         

      $('.menu-block-2 .menu-mlid-1156 a').click(function() {
        ga('send', 'event', 'Menu', '2nd Menu', 'Work for Us' );
      });       

      $('.menu-block-2 .menu-mlid-681 a').click(function() {
        ga('send', 'event', 'Menu', '2nd Menu', 'Contact Us' );
      });          
      
      //Block
      
      $('.block-block-15 ul li:nth-child(1) a').click(function() {
        ga('send', 'event', 'Menu', 'Whats Next', 'Donate Now' );
      });

      $('.block-block-15 ul li:nth-child(2) a').click(function() {
        ga('send', 'event', 'Menu', 'Whats Next', 'Sponsor a Stone' );
      });
      
      $('.block-block-15 ul li:nth-child(3) a').click(function() {
        ga('send', 'event', 'Menu', 'Whats Next', 'View Upcoming Events' );
      });
      
      $('.block-block-15 ul li:nth-child(4) a').click(function() {
        ga('send', 'event', 'Menu', 'Whats Next', 'Browse our Media Gallery' );
      });
      
      $('.block-block-15 ul li:nth-child(5) a').click(function() {
        ga('send', 'event', 'Menu', 'Whats Next', 'Support Us' );
      });

    }
  }
})(jQuery);

Creating and consuming a JSON file

paulbooker's picture
Submitted by paulbooker on Mon, 06/05/2017 - 17:46

Creating a JSON file:

/**
 * Implementation of hook_menu().
 */
function example_module_menu() {
  $items['careers/json'] = array(
    'access callback'   => true,
    'page callback'     => 'example_module_careers', // call function below
    'delivery callback' => 'drupal_json_output' // output as json
  );
  return $items;
}


function example_module_careers() {

  $query = db_select('node', 'n');
  $query->fields('n', array('nid'));
  $query->condition('n.type', 'career', '='); 
  
  $number_of_jobs = $query->countQuery()->execute()->fetchField();

  //print($number_of_jobs);

  $query = db_select('node', 'n');
  $query->leftjoin('field_data_field_quantity', 'fq', 'fq.entity_id = n.nid');
  $query->fields('n', array('nid'));
  $query->fields('fq', array('field_quantity_value'));
  $query->condition('n.type', 'career', '='); 

  $result = $query->execute();
  
  $number_of_positions = 0;
  foreach ($result as $record) {	
	  $number_of_positions += $record->field_quantity_value;
  }
  //print($number_of_positions);
 
  $results = array('number_of_jobs' => $number_of_jobs, 'number_of_positions' => $number_of_positions);
  //print_r($results); 
  //exit;
  return array('results'=>$results,);
  
}

Consuming a JSON file:

if ($json_url) {
  $request = drupal_http_request($json_url);
  $careers = drupal_json_decode($request->data);
  $number_of_jobs = $careers['results']['number_of_jobs'];
  $number_of_positions = $careers['results']['number_of_positions'];
} 

This could be placed inside template.php or inside a Views Global: PHP field.

Adapting an existing Drupal theme for mobile devices.

paulbooker's picture
Submitted by paulbooker on Fri, 05/05/2017 - 18:11
@media screen and (max-width: 680px) {
  #head,
  #page,
  #footer-region {
    width: 100%;
  }
  
  #content,
  #sidebar-primary {
    float: none;
    width: 100%;
  }
  
  #sidebar-primary .block {
    float: none;
    width: 100%;
  }
	
  .sidebar-first #content {
    width: 100%;	
  }	 
	
  #triptych-first, #triptych-second {
    padding: 0;
  }
	
  img {
    max-width: 300px;
    height: auto;
  }
  
  #logo  {
    bottom: auto !important;
    position: inherit !important;
    right: auto !important;
  }  	
}
/**
 * Implements hook_page_alter().
 */
function mytheme_page_alter($page) {
  $viewport = array(
    '#type' => 'html_tag',
    '#tag' => 'meta',
    '#attributes' => array(
      'name' => 'viewport',
      'content' => 'width=device-width, initial-scale=1',
    ),
  );
  drupal_add_html_head($viewport, 'viewport');
}

Modifying the meta tag on all Drupal pages.

paulbooker's picture
Submitted by paulbooker on Mon, 10/17/2016 - 12:07
function mymodule_html_head_alter(&$head_elements) {
	  
  $head_elements['system_meta_content_type']['#attributes'] = array(
    'charset' => 'utf-8',
    'http-equiv' => "X-UA-Compatible"
  );	
}

Pages