Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!--
- Centrally-Configured Fixed-Date-And-Time Countdown Timer For Kartra
- 1. Upload a *plain-text* file containing the event time and expiration redirect URL
- (if desired) in this format to the Membership > Files area:
- eventTime = '2023-05-20T15:00Z'; /* Event date & GMT/UTC time in ISO format */
- expirationURL = 'https://example.com'; /* = ''; for no expiration redirect */
- resetTimers();
- 2. Create a tracking link pointing to the configuration file. Reuse this link on all pages
- that should share this timer. Just update the target file URL to the new upload URL if/when
- updating the configuration.
- 3. Add 1+ fixed-date-and-time countdowns to your page with a past date and no redirection.
- 4. Add this code to the BODY tracking section of your page, putting the tracking link URL
- from step 2 into the script src attribute at the bottom.
- -->
- <script>
- var eventTime, expirationURL, counters = $('[data-countdown] div.countdown').attr('data-date', null);
- function resetTimers () {
- if (!eventTime) return;
- var diffSecs = Math.max(Math.floor((+new Date(eventTime) - new Date()) / 1000), 0);
- if (diffSecs <= 0 && expirationURL) location = expirationURL;
- counters.each((n, el) => {
- var $el = $(el);
- $el.stopCountDown();
- $el.data('diffSecs', diffSecs);
- if (expirationURL) $el.data('callback', () => location = expirationURL);
- $el.startCountDown();
- });
- }
- $(() => setTimeout(resetTimers, 0));
- </script>
- <script src='https://account.krtra.com/tracking_link_here' async defer></script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement