Bing Ads Tracking Code

Community Forums Forums General Discussion Bing Ads Tracking Code

This topic is: not resolved

This topic contains 4 replies, has 2 voices, and was last updated by  philsg 6 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #90868

    philsg
    Member
    Post count: 2

    Hi,

    I need to add the Bing Ads tracking code to a thank you page but the scripts sections is no good since this code goes right before the end body tag. It’s for the executive theme.

    Bing ads tracking code (formerly ad center) is notoriously annoying since I’ve been through other tracking issues before with other non wordpress sites.

    Any one knows?

    #90883

    braddalton
    Participant
    Post count: 9204

    You can hook it in conditionally using a custom function with genesis_hook that executes immediately before the closing body tag

    Another option is to use wp_enqueue_scripts function and also register the script so you can use it again if needed and not cause any conflicts

    With the 5th parameter

    $in_footer
    (boolean) (optional) Normally, scripts are placed in <head> of the HTML document. If this parameter is true, the script is placed before the </body> end tag. This requires the theme to have the wp_footer() template tag in the appropriate place.
    Default: false


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #91089

    philsg
    Member
    Post count: 2

    Great, thanks Brad. Do you think the code below could work on the wp_footer() hook? The Bing Ads tracking code is supposed to go just before the end body tag of the confirmation page, in this case the Thank You page

    <?php if (is_page( ‘Thank You’ ) ) { ?>
    <p><script type=”text/javascript”> if (!window.mstag) mstag = {loadTag : function(){},time : (new Date()).getTime()};</script> <script id=”mstag_tops” type=”text/javascript” src=”//flex.msn.com/mstag/site/684dbeb8-831f-4965-bc03-e017676deb92/mstag.js”></script> <script type=”text/javascript”> mstag.loadTag(“analytics”, {dedup:”1″,domainId:”1438847″,type:”1″,actionid:”48555″})</script> <noscript> <iframe src=”//flex.msn.com/mstag/tag/684dbeb8-831f-4965-bc03-e017676deb92/analytics.html?dedup=1&domainId=1438847&type=1&actionid=48555″ frameborder=”0″ scrolling=”no” width=”1″ height=”1″ style=”visibility:hidden;display:none”> </iframe> </noscript></p>
    <?php } ?>

    #91484

    braddalton
    Participant
    Post count: 9204

    Can’t read or copy your code.

    Please paste it from your file into a Github Gist and embed it here. Thanks


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #91487

    philsg
    Member
    Post count: 2

    Sorry Brad, here it is <script src=”https://gist.github.com/anonymous/d5249871a5f9639f42eb.js”></script>
    thanks for your help.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.