orchardcms - include Facebook Pixel Code js in orchard -


i need add facebook pixel code script in head section of every page.

<!-- facebook pixel code --> <script> !function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callmethod? n.callmethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n; n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createelement(e);t.async=!0; t.src=v;s=b.getelementsbytagname(e)[0];s.parentnode.insertbefore(t,s)}(window, document,'script','//connect.facebook.net/en_us/fbevents.js');  fbq('init', 'xxx'); fbq('track', "pageview");</script> <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=xxx&ev=pageview&noscript=1" /></noscript> <!-- end facebook pixel code --> 

how can this? started working on orchard. read edit cshtml or edit theme...

thanks

there should layout.cshtml file in themes directory, can add script this:

@using ( script.head() ) {     <!-- facebook pixel code -->     <script>         !function (f, b, e, v, n, t, s) {             if (f.fbq) return; n = f.fbq = function () {                 n.callmethod ?                 n.callmethod.apply(n, arguments) : n.queue.push(arguments)             }; if (!f._fbq) f._fbq = n;             n.push = n; n.loaded = !0; n.version = '2.0'; n.queue = []; t = b.createelement(e); t.async = !0;             t.src = v; s = b.getelementsbytagname(e)[0]; s.parentnode.insertbefore(t, s)         }(window,         document, 'script', '//connect.facebook.net/en_us/fbevents.js');          fbq('init', 'xxx');         fbq('track', "pageview");</script>         <noscript>             <img height="1" width="1" style="display:none"                  src="https://www.facebook.com/tr?id=xxx&ev=pageview&noscript=1" />         </noscript>     <!-- end facebook pixel code --> } 

alternatively, copy document.cshtml located in *orchard.web\core\shapes\views* theme , insert script directly in head section.


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

python - pip wont install .WHL files -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -