Skip to content
This repository has been archived by the owner on May 3, 2022. It is now read-only.

Commit

Permalink
Bump to version 1.0.9
Browse files Browse the repository at this point in the history
1. Add option to display quiz results before requiring user to give
contact information
  • Loading branch information
Aaron Huisinga committed May 4, 2017
1 parent d513edf commit 061e9cd
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 112 deletions.
100 changes: 20 additions & 80 deletions assets/js/scripts.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
jQuery(function ($) {
jQuery('document').ready(function ($) {
_paq.push(['trackEvent', 'Quiz', 'Unique Visitor']);
if(typeof _paq !== 'undefined') {
_paq.push(['trackEvent', 'Quiz', 'Unique Visitor']);
}

// Simple AJAX listeners
$(document).bind("ajaxSend", function () {
Expand All @@ -13,7 +15,10 @@ jQuery(function ($) {
updateProgressBar(1);
$('.footer').addClass('animated fadeOutDown');
$('.footer-quiz').addClass('animated fadeInUpBig').show();
_paq.push(['trackEvent', 'Quiz', 'Started']);

if(typeof _paq !== 'undefined') {
_paq.push(['trackEvent', 'Quiz', 'Started']);
}

setTimeout(function () {
$('.footer').hide();
Expand Down Expand Up @@ -105,9 +110,12 @@ jQuery(function ($) {
});

// Show quiz results modal
$('#get-results').click(function () {
$('body').on('click', '#get-results', function () {
$('#quiz-results').modal('show');
_paq.push(['trackEvent', 'Quiz', 'Opened Modal']);

if(typeof _paq !== 'undefined') {
_paq.push(['trackEvent', 'Quiz', 'Opened Modal']);
}

return false;
});
Expand Down Expand Up @@ -147,50 +155,13 @@ jQuery(function ($) {
}
$('.quiz-page').animate({'padding-top': '6%'}, 500);

var retargeting = $('#retargeting').val();
var conversion = $('#conversion').val();
if (retargeting != '') {
!function (f, b, e, v, n, t, s) {
if (f.fbq)return;
n = f.fbq = function () {
n.callMethod ?
n.callMethod.apply(n, arguments) : n.queue.push(arguments)
};
if (!f._fbq) f._fbq = n;
n.push = n;
n.loaded = !0;
n.version = '2.0';
n.queue = [];
t = b.createElement(e);
t.async = !0;
t.src = v;
s = b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t, s)
}(window,
document, 'script', '//connect.facebook.net/en_US/fbevents.js');

fbq('init', retargeting);
fbq('track', 'PageView');
}
if (conversion != '') {
!function (f, b, e, v, n, t, s) {
if (f.fbq)return;
n = f.fbq = function () {
n.callMethod ?
n.callMethod.apply(n, arguments) : n.queue.push(arguments)
};
if (!f._fbq) f._fbq = n;
n.push = n;
n.loaded = !0;
n.version = '2.0';
n.queue = [];
t = b.createElement(e);
t.async = !0;
t.src = v;
s = b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t, s)
}(window,
document, 'script', '//connect.facebook.net/en_US/fbevents.js');
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,'script','//connect.facebook.net/en_US/fbevents.js');

fbq('init', conversion);
fbq('track', 'PageView');
Expand Down Expand Up @@ -243,6 +214,7 @@ jQuery(function ($) {
// Show quiz results
function showResults() {
var form = $('#chiro-quiz');
var broker = $('#broker').val();

$.ajax({
type: 'POST',
Expand All @@ -254,40 +226,8 @@ jQuery(function ($) {
$('#quiz-back').hide();

setTimeout(function () {
$('#offer').html('<h2 class="quiz-completed"><i class="fa fa-check-circle"></i> <br> <strong>You scored ' + response.score + '/100</strong><br><small>' + response.feedback + '</small></h2>');
if (typeof $('#valuator-link').val() != 'undefined') {
$('#offer').html('<h2 class="quiz-completed"><i class="fa fa-check-circle"></i> <br> <strong>You scored ' + response.score + '/100</strong><br><small>' + response.feedback + '</small></h2> <a href="' + $('#valuator-link').val() + '" class="btn btn-primary btn-lg" id="show-offer">Click Here To See What Your Home Is Worth <br> <small>(Based On Official Data of Recently Sold Listings In Your Area)</small></a>');
}
$('#offer').html('<h2 class="quiz-completed"><i class="fa fa-check-circle"></i> <br> <strong>You scored ' + response.score + '/100</strong></h2><h4>' + response.feedback + '<br><br><strong>You are eligible for free chirotherapy at ' + broker + '.<br>Click below for more info.</strong></h4><button class="btn btn-primary btn-lg" id="get-results">Send Me The Details!</button>');
$('.quiz-page').animate({'padding-top': '6%'}, 500);

var retargeting = $('#retargeting').val(),
conversion = $('#conversion').val();
if (conversion != '') {
if (conversion !== retargeting) {
!function (f, b, e, v, n, t, s) {
if (f.fbq)return;
n = f.fbq = function () {
n.callMethod ?
n.callMethod.apply(n, arguments) : n.queue.push(arguments)
};
if (!f._fbq) f._fbq = n;
n.push = n;
n.loaded = !0;
n.version = '2.0';
n.queue = [];
t = b.createElement(e);
t.async = !0;
t.src = v;
s = b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t, s)
}(window,
document, 'script', '//connect.facebook.net/en_US/fbevents.js');

fbq('init', conversion);
}

fbq('track', "Lead");
}
}, 1000);
}
});
Expand Down Expand Up @@ -318,7 +258,7 @@ jQuery(function ($) {
}
}

if (step != '') {
if (step != '' && typeof _paq !== 'undefined') {
_paq.push(['trackEvent', 'Quiz', 'Answered Question', step]);
}

Expand Down
4 changes: 2 additions & 2 deletions chiro-quiz.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/*
* Plugin Name: Chiropractic Quiz
* Version: 1.0.8
* Version: 1.0.9
* Plugin URI: https://platform.marketing/
* Description: Simple chiropractic lead generation through a quiz that helps qualify prospective patients.
* Author: Platform Marketing
Expand All @@ -20,7 +20,7 @@
define( 'CHIRO_QUIZ_PLUGIN_PATH', trailingslashit( plugin_dir_path( __FILE__ ) ) );

if ( ! defined( 'CHIRO_QUIZ_PLUGIN_VERSION' ) )
define( 'CHIRO_QUIZ_PLUGIN_VERSION', '1.0.8' );
define( 'CHIRO_QUIZ_PLUGIN_VERSION', '1.0.9' );

require_once( 'classes/class-chiro-quiz.php' );

Expand Down
4 changes: 2 additions & 2 deletions classes/class-chiro-quiz.php
Original file line number Diff line number Diff line change
Expand Up @@ -460,8 +460,8 @@ public function get_custom_fields_settings()
];

$fields['show_fields'] = [
'name' => __('Show Opt-In Fields', $this->token),
'description' => __('If set to no, opt-in fields will not be shown, and users will be shown their score and prompted to fill out the Home Valuator.', $this->token),
'name' => __('Show Opt-In Before Score', $this->token),
'description' => __('If set to no, opt-in fields will be shown after the users see their score.', $this->token),
'placeholder' => '',
'type' => 'select',
'default' => 'yes',
Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: Aaron Huisinga
Tags: chiropractic, platform, chiro quiz
Requires at least: 4.0
Tested up to: 4.7.4
Stable tag: 1.0.8
Stable tag: 1.0.9

Simple chiropractic lead generation through a quiz that helps qualify prospective patients.

Expand Down
47 changes: 20 additions & 27 deletions templates/single-quiz.php
Original file line number Diff line number Diff line change
Expand Up @@ -1530,6 +1530,7 @@
</div>
</div>

<input type="hidden" id="broker" value="<?= $broker ?>">
<div class="footer"><?php echo $broker;
if (isset($phone) && $phone != null) {
echo ' &middot; ' . $phone;
Expand Down Expand Up @@ -1558,8 +1559,11 @@
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<h3>Awesome! Your quiz results have been calculated. <br> Where should we email your results?
</h3>
<?php if (isset($show_fields) && $show_fields == 'no') { ?>
<h3 style="font-size:20px;line-height:24px">You are eligible for free chirotherapy at <?= $broker ?>.</h3>
<?php } else { ?>
<h3 style="font-size:20px;line-height:24px">Awesome! Your quiz results have been calculated. <br> Where should we email your results?</h3>
<?php } ?>

<div class="form-group">
<label for="first_name" class="control-label sr-only">First Name</label>
Expand All @@ -1575,7 +1579,11 @@
<?php wp_nonce_field($token . '_submit_quiz', $token . '_nonce'); ?>
<input name="quiz_id" type="hidden" value="<?= $id ?>">

<input type="submit" class="btn btn-primary btn-lg" id="submit-results" value="Get My Results!">
<?php if (isset($show_fields) && $show_fields == 'no') { ?>
<input type="submit" class="btn btn-primary btn-lg" id="submit-results" value="Send Me The Details!">
<?php } else { ?>
<input type="submit" class="btn btn-primary btn-lg" id="submit-results" value="Get My Results!">
<?php } ?>
</div>
</div>
</div>
Expand All @@ -1587,32 +1595,17 @@
?>
<!-- Facebook Pixel Code -->
<script>
!function (f, b, e, v, n, t, s) {
if (f.fbq)return;
n = f.fbq = function () {
n.callMethod ?
n.callMethod.apply(n, arguments) : n.queue.push(arguments)
};
if (!f._fbq) f._fbq = n;
n.push = n;
n.loaded = !0;
n.version = '2.0';
n.queue = [];
t = b.createElement(e);
t.async = !0;
t.src = v;
s = b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t, s)
}(window,
document, 'script', '//connect.facebook.net/en_US/fbevents.js');
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,'script','//connect.facebook.net/en_US/fbevents.js');

fbq('init', '<?= $retargeting ?>');
fbq('track', "PageView");</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=<?= $retargeting ?>&ev=PageView&noscript=1"
/></noscript>
<?php
echo '<input type="hidden" id="retargeting" value="' . $retargeting . '">';
fbq('track', 'PageView');
</script>
<noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=<?= $retargeting ?>&ev=PageView&noscript=1"/></noscript>
<?php
}

if ($conversion != '') {
Expand Down

0 comments on commit 061e9cd

Please sign in to comment.