• Tested on four sites with different server configurations and various custom post types. Works like a charm! I would know!

Viewing 10 replies - 1 through 10 (of 10 total)
  • sideshowtodd

    (@sideshowtodd)

    Does this only work with Facebook, or can it put any line of javascript generated by any conversion pixel generator into the head section of a page?

    Thread Starter Kellen Mace

    (@kellenmace)

    You can paste in any line of javascript and it will insert it into the head of the webpage.

    I was thinking about adding a feature to validate that a legitimate FB Pixel Code had been entered, and display an error if there were any issues with it, however. Out of curiosity, what conversion pixel generator code do you want to be able to insert, other that those from Facebook? If I add that validation feature, maybe I could add support for other types of conversion codes as well.

    Thanks for your interest ??

    sideshowtodd

    (@sideshowtodd)

    mediamath / mathtag

    Thread Starter Kellen Mace

    (@kellenmace)

    Okay, I’ll keep that in mind. Thanks!

    dpbraun

    (@dpbraun)

    Kellen, can you change your plugin, or allow the option, to place it in the footer instead of the header?

    Thread Starter Kellen Mace

    (@kellenmace)

    dpbraun,

    Facebook only recommends placing the conversion pixel code in the <head> section of your website, as outlined on this page. This is because the javascript is loaded asynchronously, meaning placing it in the <head> section won’t slow down the load time of the rest of the webpage.

    Also, the “Where to Place the Pixel on the Page” section of this page does a good job in explaining why loading the pixel code as early as possible in the page load process is the most effective way to capture data on your users.

    I hope that helps out. Please let me know if you have any other questions. Thanks for your interest in using my plugin!

    dpbraun

    (@dpbraun)

    Sounds good, Kellen. I am using your plugin, seems like you did a great job!

    One other question: My home page on the site is not a static page, but a posts page. I can edit the index page (I think it’s that one) to manually add code, but I’d rather not. Would it make sense to add that option to your plugin? (unless it’s already there and I missed it somehow).

    Thanks,

    Dave

    Thread Starter Kellen Mace

    (@kellenmace)

    Dave,

    That’s an excellent idea. I have made a note to add the ability to insert conversion pixel codes into the front posts page / blog page the next time I have a chance to release an update. Yes, it would be the controlled by the home.php or index.php page template, depending on your theme.

    If you want a quick and easy solution in the meantime, you can:

    1. Paste the code below into a text editor (notepad on Windows, TextEdit on Mac, etc.) and replace the “PASTE CONVERSION PIXEL CODE HERE” text with the conversion pixel code you want to use.
    2. Save the text file as “facebook-conversion-pixel-for-blog-page.php” and upload it to the wp-content/plugins folder on your website, where all the plugins live.
    3. From the Dashboard, go to Plugins > Installed plugins and activate the plugin.
    4. Let the good times roll! And, please give my plugin a 5 star review if you found it (and me) to be helpful ?? Thanks!

    <?php
    /*
    Plugin Name: Add Facebook Conversion Pixel to Blog Page
    Description: Add Facebook Conversion Pixel to Blog Page
    Version: 1.0
    Author: Kellen Mace
    Author URI: https://kellenmace.com/
    License: GPLv2 or later
    License URI: https://www.gnu.org/licenses/gpl-2.0.html
    */

    function fb_pxl_insert_code_on_blog() {
    if ( is_home() ) {
    $fb_pxl_code = “

    PASTE CONVERSION PIXEL CODE HERE

    “;
    echo $fb_pxl_code;
    }
    }
    add_action( ‘wp_head’, ‘fb_pxl_insert_code_on_blog’ );
    ?>

    dpbraun

    (@dpbraun)

    Ok, will do, and thanks so much for the custom plugin, Kellen!

    Thread Starter Kellen Mace

    (@kellenmace)

    You’re very welcome ??

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Works like a charm!’ is closed to new replies.