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
<script type="text/javascript"> | |
/* | |
* Heavily based on https://discourse.webflow.com/t/native-linking-to-previous-and-next-post-or-page-using-cms/19525/19 | |
* This one uses regular ol' javascript instead of jQuery. | |
* | |
* # How this script works: | |
* | |
* 1. It looks for a hidden collection on the page and gets all the items in it. | |
* 2. Using the current item, it identifies the items before and after it. | |
* 3. It then looks for the prev and next buttons on the page and updates those with the correct links. |
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
/** | |
* Passphrase. | |
* Simple passphrase entry | |
*/ | |
const accessMap = { | |
"tennessee": ['Caroline', 'Clay'], | |
"leia": ['Dog Walkers'], | |
"coffee": ['Jonathan', 'Connie'] | |
}; |
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
(function(w, doc) { | |
const cookieKey = 'your_cookie'; | |
let hasCookie = doc.cookie.split(';').filter((c) => { | |
let [k, _v] = c.split('='); | |
return k == cookieKey; | |
}).length > 0; | |
if (!hasCookie) { |
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
// Add the following snippet to your application after loading Appcues and Intercom. | |
Appcues.on('form_submitted', function(data) { | |
var responses = {}; | |
// Intercom doesn't like special characters. | |
var slugify = function(str) { | |
return str.toString().toLowerCase() | |
.replace(/\s+/g, '-') // Replace spaces with - | |
.replace(/[^\w\-]+/g, '') // Remove all non-word chars | |
.replace(/\-\-+/g, '-') // Replace multiple - with single - |
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
function main() { | |
var date = new Date(), | |
prev30Date = new Date(date - 30*24*60*60*1000), | |
today = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`, | |
prev30 = `${prev30Date.getFullYear()}-${prev30Date.getMonth() + 1}-${prev30Date.getDate()}`; | |
return Events({ | |
from_date: prev30, | |
to_date: today, | |
event_selectors: [{event: "Form Submitted (Appcues)"}] |
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
<!-- ... Appcues scripts installed higher up ... --> | |
<!-- Intercom Installation --> | |
<script> | |
window.intercomSettings = { | |
// TODO: The current logged in user's full name | |
name: 'Jonathan Kim', | |
user_id: '123456', | |
first_name: 'Jonathan', | |
email: '[email protected]', |
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
<script> | |
(function() { | |
if (analytics != null && analytics.ready != null) { | |
analytics.ready(function() { | |
if (window.Appcues != null) { | |
if (analytics.user().id()) { | |
// Identify known user. | |
Appcues.identify(analytics.user().id(), analytics.user().traits()); | |
} else { | |
// Identify as an anonymous user. |
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
<!-- Load Appcues ourselves, not using Segment. --> | |
<script src="//fast.appcues.com/23.js"></script> | |
<script> | |
// Listen for important events being passed to Segment. | |
analytics.on('identify', function(userId, traits) { | |
Appcues.identify(userId, traits); | |
}); | |
analytics.on('page', function() { | |
Appcues.start(); | |
}); |
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
Appcues.on('flow_form_submission', function(eventData) { | |
// Convert the responses into an object where the field label is the key and the input | |
// is the value. | |
var responsesObj = {}; | |
// Note: if your form labels are long, you may want to shorten them in this step. | |
// E.g. Convert "What is your email?" to "email" in the `forEach` loop. | |
eventData.response.forEach(function(resp) { responseObj[resp.label] = resp.value }); | |
// Track that the event happened. | |
analytics.track('Appcues Form Submitted', { |
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
var AppRouter = Backbone.Router.extend({ | |
beforeNavigate: function(fragment) { | |
// Put code you want to run before the URL changes. | |
}, | |
afterNavigate: function(fragment) { | |
// Put code you want to run after the URL changes. | |
// Wait for all other javascript to finish running, then call Appcues. | |
window.setTimeout(function() { | |
if (Appcues != null && Appcues.start != null) Appcues.start(); |
NewerOlder