Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Alistair Strachan 2 posts 22 karma points
    Jun 05, 2014 @ 11:50
    Alistair Strachan
    0

    Adding facebook conversion tracking code

    I need to add some facebook conversion  tracking code, which should go between the <head> tags according to their instructions.  What would be the best way to do this on an Umbraco site?   I'm new to Umbraco so it's not immediately obvious where to slot it in.

    Thanks

     

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jun 05, 2014 @ 13:45
    Dennis Aaen
    0

    Hi Alistair and welcome to our,

    If the facebook conversion tracking code, should be on every page, and it´s the same code I would just added in the master template, if you have one. By having a master template you can add all the markup and stuff that should be on every page.

    If you only want it on a specific page, I suggest, that you add a propery on the document type of the page type. The data type of the field could be a textbox multiple, in there you can add your script and print it on the the pages where the field has content. Documentation for the textbox multiple can be found here: http://our.umbraco.org/documentation/using-umbraco/backoffice-overview/property-editors/built-in-property-editors/Textbox-Multiple

    If you use Razor, and using partial view macros or partial views something like this should be good, if your alias of the textbox multiple is facebookConversionCode

    @{
        if(CurrentPage.HasValue("facebookConversionCode")){
            @Html.Raw(CurrentPage.facebookConversionCode)
        }     
    }

    If you don´t know about master templates, and document types in Umbraco yet, I would recommend you to take a look at these videos.

    http://umbraco.tv/videos/umbraco-v7/implementor/fundamentals/templating/introduction/ There are two videos about master templates, but maybe this good to see all of them, since you are new.

    Here are some videos about how to work with document types: http://umbraco.tv/videos/umbraco-v7/implementor/fundamentals/document-types/what-is-a-document-type/

    Hope this helps, if you have any other questions related to this subject keep asking and I would try to help. If you have other Umbraco questions, just create a new thread.

    /Dennis

  • Alistair Strachan 2 posts 22 karma points
    Jun 05, 2014 @ 17:52
    Alistair Strachan
    0

    Thank you - I'll check out those videos and see how it goes.

    Alistair

     

Please Sign in or register to post replies

Write your reply to:

Draft