User variables & answers
Insert as {user_answer}, {utm_tag} in any text fields in any place
Predefined variables
// If there subscription purchased by a user
subscriptions.paywall_ids = "1195, 1189"
subscriptions.paywall_names = "No trial - weeks,Paywall upsell 1"
subscriptions.price_external_codes = "Weekly (60%),Upsell Infographic"
subscriptions.price_external_ids = "P-1B306054UR9931515M5C6TLQ,P-1B306054UR9931515M5C6TLQxx"
subscriptions.price_ids = "1231231,345345"
project.app_links.app_store = "https://XX.onelink.me/XXX?af_xp=custom&c=web2wave&deep_link_value={user.user_id}"
project.app_links.google_play = "https://XX.onelink.me/XXX?af_xp=custom&c=web2wave&deep_link_value={user.user_id}}"
project.app_links.web = "https://XX.onelink.me/XXX?af_xp=custom&c=web2wave&deep_link_value={user.user_id}"
project.id = 192
project.legal_address
project.legal_app_store_id
project.legal_company_name
project.legal_email
project.legal_google_play_id
project.legal_jurisdiction
project.og.title = ""
project.project_id = "templates"
project.title = "Templates"
JS in field values
Use functions like this in text fields, and only this JS
function (answers) {
if (answers.satisfaction) {
if (answers.satisfaction.indexOf('Yes, I want') > -1) {
return 'Your are happy'
}
if (answers.satisfaction.indexOf('No, I have') > -1) {
return 'Your are NOT happy'
}
}
return 'Your skin is OK'
}
JS in Screens logic
Use in "JS condition" fields
function (answers) {
if (answers.satisfaction) {
if (answers.satisfaction.indexOf('Yes, I want') > -1) {
return 'question-1';
}
if (answers.satisfaction.indexOf('No, I have') > -1) {
return 'products';
}
}
return 'shape';
}
Listening for Events and Sending custom events
AnalyticsManager.on('Subscribe', function(event){
// event.currency = "AUD"
// event.eventID = "781d5918-4915-450e-9da9-bcfaaee39dfd_Subscribe_34473_0"
// event.value = 29.99
// Also you have an access to
// window.subscriptions
// It contains an array of user's subscriptions
})
Sending events to internal and external analytics
AnalyticsManager.logEvent('EventName', {value: 123})
Saving user properties
AnalyticsManager.setUserProperty('my_property', 'value')
// After that you can access properties from
window.user_properties.my_property
// or as argument in function
function(answers){
if (answers.my_property && answers.my_property.includes('answer')) {
return 'has answer';
}
}
Navigating between screens
screensManager.moveToNextScreen();
screensManager.moveToSection('screen_id');
screensManager.moveToPreviousScreen();
Detect if a user has PayPal susbcripton
let isHasPayPalSubscroption = !!subscriptions.filter(function(el){return el.payment_system_label == 'PayPal'}).length;
Change text on Buy button on Paywall when free trial price is selected
AnalyticsManager.on('Paywall click price', function(event){
let activePrice = window.paywall_products.product_info.product_data.prices.find((price) => price.id == event.price_id);
if (activePrice?.phases?.trial > 0 || activePrice.trial_free_period_length_in_days > 0) {
$('.main__plan-button').text('Star free trial')
} else {
$('.main__plan-button').text('Star my plan')
}
});
Redirect user to custom URL after quiz
Add this function to "Custom JS function to execute before Quiz finish" in Quiz settings:
function(){
location.href = 'https://YOUR-URL.com/?email={email}&user_id={user_id}'
}

