From e90bf4c6a178bb5be3842ab4a1aae9ed4b735196 Mon Sep 17 00:00:00 2001 From: Nikolas Wise Date: Tue, 2 Nov 2021 14:25:17 -0700 Subject: [PATCH 1/2] load the concert script async, check for existence of function on the window and wait for it to exist before attempting to fire concert install function --- template/source/layouts/_concert.erb | 11 ++++++++++- template/source/layouts/layout.erb | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/template/source/layouts/_concert.erb b/template/source/layouts/_concert.erb index bada813..2b58b85 100644 --- a/template/source/layouts/_concert.erb +++ b/template/source/layouts/_concert.erb @@ -1,4 +1,5 @@ \ No newline at end of file + } + + if (!window.ConcertAds) { + window.addEventListener('concertAdsReady', installConcertAds); + } else { + installConcertAds(); + } + \ No newline at end of file diff --git a/template/source/layouts/layout.erb b/template/source/layouts/layout.erb index 3f76122..91f18d5 100644 --- a/template/source/layouts/layout.erb +++ b/template/source/layouts/layout.erb @@ -73,7 +73,7 @@ <%= javascript_include_tag 'site' %> - + <%= partial('layouts/_analytics') %> From 9f8e3ac0b83562bcf6e871391c7672a7ba5f6652 Mon Sep 17 00:00:00 2001 From: lsirivong Date: Thu, 13 Jan 2022 09:41:54 -0700 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 57cb27d..c4e77d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # v2.2.0 - Add conditional rendering of AMP url to in layout.erb +- Initialize ConcertAds when ready # v2.1.0