Skip to content

Commit

Permalink
update adsense code
Browse files Browse the repository at this point in the history
  • Loading branch information
SethClydesdale committed Dec 12, 2024
1 parent 650b0dc commit 8b3e803
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions aeon-system/ga.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ if (window.location.hostname == 'sethclydesdale.github.io') {

// Adsense
(function (window, document, id) {
var adsense = document.createElement('SCRIPT'), ad;
var adsense = document.createElement('SCRIPT');
adsense.async = true;
adsense.crossorigin = 'anonymous';
adsense.src = 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=' + id;
document.head.appendChild(adsense);

// wait until DOM loaded to insert ads
window.addEventListener('DOMContentLoaded', function() {console.log('loaded');
// function for inserting ads into document
var insertAds = function() {
var content = document.getElementById('content'),
logo = document.getElementById('logo');
logo = document.getElementById('logo'), ad;

if (content && logo) {

Expand Down Expand Up @@ -61,7 +61,14 @@ if (window.location.hostname == 'sethclydesdale.github.io') {
(adsbygoogle = window.adsbygoogle || []).push({});
}
}
});
};

// wait until DOM loaded to insert ads
if (document.readyState !== 'loading') {
insertAds();
} else {
document.addEventListener('DOMContentLoaded', insertAds);
}

}(window, document, 'ca-pub-2159011770843378'));
}

0 comments on commit 8b3e803

Please sign in to comment.