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.1.3
Browse files Browse the repository at this point in the history
1. Update Facebook Pixel code with support for new system
  • Loading branch information
Aaron Huisinga committed Dec 15, 2015
1 parent 0e764ba commit 5a8af14
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 43 deletions.
48 changes: 14 additions & 34 deletions assets/js/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,24 +69,6 @@ jQuery('document').ready(function ($) {

if (validated == 1) {
$('#get-results-modal').modal('show');

var retargeting = $('#retargeting').val();
if (retargeting !== '') {
(function () {
var _fbq = window._fbq || (window._fbq = []);
if (!_fbq.loaded) {
var fbds = document.createElement('script');
fbds.async = true;
fbds.src = '//connect.facebook.net/en_US/fbds.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(fbds, s);
_fbq.loaded = true;
}
_fbq.push(['addPixelId', retargeting]);
})();
window._fbq = window._fbq || [];
window._fbq.push(['track', 'PixelInitialized', {}]);
}
}

return false;
Expand All @@ -113,22 +95,20 @@ jQuery('document').ready(function ($) {
$('#homes-report,.modal-backdrop').remove();
$('.results').show();

var conversion = $('#conversion').val();

if (conversion !== '') {
(function () {
var _fbq = window._fbq || (window._fbq = []);
if (!_fbq.loaded) {
var fbds = document.createElement('script');
fbds.async = true;
fbds.src = '//connect.facebook.net/en_US/fbds.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(fbds, s);
_fbq.loaded = true;
}
})();
window._fbq = window._fbq || [];
window._fbq.push(['track', conversion, {'value': '0.00', 'currency': 'USD'}]);
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
8 changes: 4 additions & 4 deletions classes/class-homes-report.php
Original file line number Diff line number Diff line change
Expand Up @@ -540,8 +540,8 @@ public function get_custom_fields_settings($meta_box)
if ($meta_box == 'marketing' || $meta_box == 'all') {
// Step before opt-in (after clicking button, before opt-in)
$fields['retargeting'] = [
'name' => __('Retargeting (optional)', $this->token),
'description' => __('Facebook retargeting pixel to allow retargeting of people that view this page. (optional).', $this->token),
'name' => __('Facebook Pixel - Retargeting (optional)', $this->token),
'description' => __('Facebook Pixel to allow retargeting of people that view this page.', $this->token),
'placeholder' => __('Ex: 4123423454', $this->token),
'type' => 'text',
'default' => '',
Expand All @@ -550,8 +550,8 @@ public function get_custom_fields_settings($meta_box)

// After opt-in
$fields['conversion'] = [
'name' => __('Conversion Tracking (optional)', $this->token),
'description' => __('Facebook conversion tracking pixel to help track performance of your ad (optional).', $this->token),
'name' => __('Facebook Pixel - Conversion (optional)', $this->token),
'description' => __('Facebook Pixel to allow conversion tracking of people that submit this quiz.', $this->token),
'placeholder' => __('Ex: 170432123454', $this->token),
'type' => 'text',
'default' => '',
Expand Down
4 changes: 2 additions & 2 deletions homes-report.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php namespace ColdTurkey\HomesReport;
/*
* Plugin Name: Homes Report
* Version: 1.1.2
* Version: 1.1.3
* Plugin URI: http://www.coldturkeygroup.com/
* Description: WordPress funnel that collects visitor contact information in exchange for a customized report from a Real Estate agent.
* Author: Cold Turkey Group
Expand All @@ -20,7 +20,7 @@
define('HOMES_REPORT_PLUGIN_PATH', trailingslashit(plugin_dir_path(__FILE__)));

if (!defined('HOMES_REPORT_PLUGIN_VERSION'))
define('HOMES_REPORT_PLUGIN_VERSION', '1.1.2');
define('HOMES_REPORT_PLUGIN_VERSION', '1.1.3');

require_once('classes/class-homes-report.php');

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: real estate, platform, homes report
Requires at least: 3.5
Tested up to: 4.3
Stable tag: 1.1.2
Stable tag: 1.1.3

WordPress funnel that collects visitor contact information in exchange for a customized report from a Real Estate agent.

Expand Down
26 changes: 24 additions & 2 deletions templates/single-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,30 @@
} ?>
</div>

<?= '<input type="hidden" id="retargeting" value="' . $retargeting . '">' ?>
<?= '<input type="hidden" id="conversion" value="' . $conversion . '">' ?>
<?php
if ( $retargeting != null ) {
?>
<!-- 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');

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 . '">';
}

if ( $conversion != null ) {
echo '<input type="hidden" id="conversion" value="' . $conversion . '">';
}
?>
</div>

<?php wp_footer(); ?>

0 comments on commit 5a8af14

Please sign in to comment.