This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// src/Form/SettingsForm.php | |
/* Include theses dependencies in my_custom_module.info.yml | |
dependencies: | |
- drupal:file | |
- drupal:image | |
*/ | |
namespace Drupal\my_custom_module\Form; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Standardish tracking code here at the top. | |
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXX-X"></script> | |
<script> | |
window.dataLayer = window.dataLayer || []; | |
function gtag(){dataLayer.push(arguments);} | |
gtag('js', new Date()); | |
gtag('config', 'UA-XXXXXX-X'); | |
// Add this to track clicks on outbound links as events. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is meant to be included on child frames created with http://blog.apps.npr.org/pym.js/ | |
// This script checks if our page is iframed, and if so, induces it to cooperate. | |
// This can allow us to use the same template for all pages on a site, and make being a child iframe an option for any page. | |
document.addEventListener('DOMContentLoaded', function () { | |
var inIFrame = (window.location != window.parent.location) ? true : false; | |
if(inIFrame) { | |
// If this page is in a iframe... | |
// ... Load pym.js into this page. | |
var pymjs = document.createElement('script'); | |
pymjs.src = 'https://pym.nprapps.org/pym.v1.min.js'; |