简体   繁体   中英

Facebook Pixel on web site using DNN

I am trying to implement the Facebook pixel into a site built on the DNN platform. How can I achieve this?

The easiest way is to add it to the bottom of your Skin by opening it in a Text Editor and paste the code at the bottom. The skin files are either located in /Portals/_default/Skins/{SkinName} or /Portals/{PortalID}/Skins/{SkinName} . In there are files with the .ascx extension, that are the ones you need to edit.

You can also add a Text/HTML module to the page, and then display that module on every page. You can do this in Module Settings > Advanced Settings > CheckBox: Display module on all pages.

Referring to VDWWD's answer and OP's comment, I see two ways of going about adding custom events in specific places:

  1. The tedious way: On each page, add a text/html module on the relevant pages, put the fb pixel javascript code inside it. You'll have to choose plain text mode in the text/html module, to make sure that the javascript code is not parsed out. Tedious, but it will work. If you don't want to use the text/html module, you can make multiple, renamed copies of your skin .ascx files, and assign a specific copy with a specific fb pixel snippet to each specific page in question.

  2. The not so tedious way: If you know of a DNN module named XMod Pro, you can use their templates feature to easily add any code to any page. That code can be server side AND client side, which is what makes it great if you perhaps need the user's UserID and if you need a URL parameter of the page, or anything else that's server side and of use to you.

Hope this helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM