Viewing 4 posts - 1 through 4 (of 4 total)
-
AuthorPosts
-
October 3, 2018 at 9:45 pm #1017602
Hi!
What is the best way to add my retargeting code to the body of my website?Thanks!
October 4, 2018 at 5:14 am #1017671Hey É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,
MikeOctober 4, 2018 at 5:28 am #1017674This reply has been marked as private.October 4, 2018 at 6:27 am #1017698Hi,
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