Add option to defer loading pixel

Created on 10 February 2022, almost 3 years ago
Updated 8 September 2024, 2 months ago

Problem/Motivation

See
https://stackoverflow.com/questions/59835795/facebook-pixel-slows-down-p...

Proposed resolution

a) load async: https://stackoverflow.com/questions/44873285/loading-facebook-pixel-async
b) Move to footer by altering the library

This should be optional (by setting) as of https://developers.facebook.com/docs/meta-pixel/get-started saying

To install the Pixel, we highly recommend that you add its base code between the opening and closing tags on every page where you will be tracking website visitor actions. Most developers add it to their website's persistent header, so it can be used on all pages.

Placing the code within your tags reduces the chances of browsers or third-party code blocking the Pixel's execution. It also executes the code sooner, increasing the chance that your visitors are tracked before they leave your page.

Further resources:
https://coraldigital.io/google/increase-page-speed-defer-facebook-pixel/
https://josephpinder.com/blog/facebook-pixel-is-slowing-down-your-websit...

Remaining tasks

User interface changes

API changes

Data model changes

✨ Feature request
Status

Needs work

Version

2.0

Component

Code (Facebook Pixel)

Created by

πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States rhovland Oregon

    The facebook pixel tracking code is already being loaded async.

  • πŸ‡ΊπŸ‡ΈUnited States rhovland Oregon

    I propose changing this issue to:
    "Add option to defer loading pixel"

    And adding an option "Defer loading pixel until after page load" which when checked adds defer=true to the tracking code. This will tell the browser to wait to load the main tracking script. The stub will still be inserted on the page but that shouldn't have the same performance impact as loading the pixel library does.

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    @rhovland agreed!

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica
Production build 0.71.5 2024