Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1017602

    Hi!
    What is the best way to add my retargeting code to the body of my website?

    Thanks!

    #1017671

    Hey Érik,
    Try adding this code to the end of your functions.php file in Appearance > Editor:

    function add_google_remarketing(){
    ?>
    // YOUR CODE GOES HERE
    <?php
    }
    add_action('wp_footer', 'add_google_remarketing');

    or you could use a plugin such as: Google Remarketing

    Best regards,
    Mike

    #1017674
    This reply has been marked as private.
    #1017698

    Hi,
    You should place it before the last ?> you can move that down a few lines, it is the end of the file.
    Your function should look like this:

    <?php 
    
    // logo personnalise
    function childtheme_custom_login() {
    echo '<link rel="stylesheet" type="text/css" href="' . get_bloginfo('stylesheet_directory') . '/login.css" />';
    }
    
    add_action('login_head', 'childtheme_custom_login');
    
    function add_google_remarketing(){
    ?>
    <script type="text/javascript">
    var districtmPixel = {};
    districtmPixel.revenueValue = '0.00';
    (function(){
    var dm = document.createElement('script');
    dm.async = true;
    dm.src = '//cdn.pixlads.com/agencies/1/advertisers/1163/audience.js';
    var ref = document.getElementsByTagName('script')[0];
    ref.parentNode.insertBefore(dm, ref);
    })();
    </script>
    <?php
    }
    add_action('wp_footer', 'add_google_remarketing');
    
    
    ?>

    Please make these changes via FTP or your webhost file manager, so if you make a mistake and your site crashes you can edit the file back to the way it was.
    Notice how I placed your code with the