Will it cause any issue if I use multiple Facebook Pixel in one page?

后端 未结 6 1998
暗喜
暗喜 2020-12-29 03:10

I would like to include both my Facebook Pixel id and customer\'s Facebook Pixel id in one page, so both of us can have some insight about users, and customer can also creat

6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-29 03:46

    I had the same requirement and I found that it is possible and you don't need to hack the Facebook pixel code.

    Even if it is not documented, the fbq object support multiple pixel ids.

    Just call multiple times the init function with different pixel ids. Then, then when you do fbq('track', "PageView"); it will issue one event per pixel. You can call fbq('track', '{{your_event_name}}')as many times as you want and it will track the event for all previously initialized pixels.

    So your final code would look like this:

    
    
    

    Edited April 2019 @chuck-le-butt found that a blog post from facebook document how to use the pixel: https://developers.facebook.com/ads/blog/post/2017/11/28/event-tracking-with-multiple-pixels-tracksingle/

提交回复
热议问题