[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 89
  • Last Modified:

conversion pixel not firing

My php code is shown below........    but the facebook conversion pixel is not firing.....  the page is redirecting...

do you have a better way to redirect this so the first part of code fires?  


<!-- Facebook Conversion Code for Survival Lead Machine -->
<script>(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', '6015483610963', {'value':'0.01','currency':'INR'}]);
</script>
<noscript><img height="1" width="1" alt="" style="display:none" src="https://www.facebook.com/tr?ev=6015483610963&cd[value]=0.01&amp;cd[currency]=INR&amp;noscript=1" /></noscript>



<script>


window.location = "http://kahunanow.com/cpv/base3.php?adsub=1";
</script>
0
giancarlo barraza
Asked:
giancarlo barraza
  • 3
  • 2
1 Solution
 
GaryCommented:
Do you mean the image? It won't when you have js enabled - not sure what you mean.
0
 
giancarlo barrazaAuthor Commented:
this whole page is in page.php   so when something gives me their email  i redirect them to this page so i can track certain things   then redirect to the offer......

somehow the first code is not firing before it redirects to http://kahunanow.com/cpv/base3.php?adsub=1  (see code below)        do you see any problem with the structure ?

<!-- Facebook Conversion Code for Survival Lead Machine -->
<script>(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', '6015483610963', {'value':'0.01','currency':'INR'}]);
</script>
<noscript><img height="1" width="1" alt="" style="display:none" src="https://www.facebook.com/tr?ev=6015483610963&cd[value]=0.01&amp;cd[currency]=INR&amp;noscript=1" /></noscript>
0
 
GaryCommented:
Are you talking about the Facebook code not firing?
That code will take time to load by which time (about a nano second later) you are redirecting the page.

Try changing
fbds.async = true;

to
fbds.async = false;

That should halt the page until it is finished, though I am not familiar with the code.
0
 
giancarlo barrazaAuthor Commented:
ok how can i get a redirect script that loads for a few seconds so it lets the code run?
0
 
GaryCommented:
You could just add a timeout to the page to do the redirect after 5 seconds

setTimeout(function () {
   window.location = "http://kahunanow.com/cpv/base3.php?adsub=1";
}, 5000);

Open in new window

0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now