const urlLoc = window.location; const pathLoc = urlLoc.pathname.split('/'); const unnecessaryPaths = ['react-native', 'docs']; const labelLoc = pathLoc .filter(paths => !unnecessaryPaths.includes(paths.toLowerCase())) .join('/'); function giveFeedback(value) { ga('send', { hitType: 'event', eventCategory: 'button', eventAction: 'feedback', eventLabel: labelLoc, eventValue: value, }); event.target.parentNode.innerHTML = `Thanks for letting us know!`; } if (pathLoc[1] === 'docs' || pathLoc[2] === 'docs') { document.addEventListener('DOMContentLoaded', function() { const container = document.querySelector('.container.mainContainer .post'); if (container) { const div = document.createElement('div'); div.innerHTML = `
Is this page useful?
`; const content = div.childNodes[0]; container.appendChild(content, container.childNodes[0]); } }); }