Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

with-facebook-pixel: new implementation with app folder #49880

Merged
merged 12 commits into from Jun 15, 2023

Conversation

niko20
Copy link
Contributor

@niko20 niko20 commented May 16, 2023

What?

  • Facebook pixel implementation with the new app folder structure.
  • The pixel script can now be kept in the public folder.
  • The Facebook script can be placed in the layout.js file
  • A component called FacebookPixel is provided to handle the initial script setup and manage PageView events when the page changes.
  • Classic implementation with pages folder now is in _pages

Why?

To provide an example of implementing the new app folder structure with Next.js ˆ13, which includes using the new files like layout, page, etc.

How?

Utilizing the next/script package and the layout.js file to initialize the Facebook pixel when the application starts and manage subsequent events.

Evidence of Implementation:

Here are some examples that demonstrate the successful implementation of the Facebook pixel using the new app folder structure and Next.js ˆ13

Tracking main page app/page.js
image

image

Tracking another path app/about/page.js
image

image

navigation between pages with next/link
image

@niko20 niko20 requested review from a team, leerob and steven-tey as code owners May 16, 2023 20:16
@ijjk ijjk added the examples Issue/PR related to examples label May 16, 2023
@niko20
Copy link
Contributor Author

niko20 commented May 16, 2023

@lfades ✋🏻 please help me with this contribution, I worked on the last examples and now it's an example of Facebook pixel but using the new app folder.

😃

@dvakatsiienko
Copy link
Contributor

Hi! The linter fails here

@niko20 niko20 requested a review from a team as a code owner May 19, 2023 23:37
@niko20 niko20 force-pushed the facebook-pixel-example-app branch from bd87c3a to 91260a9 Compare May 19, 2023 23:43
@niko20
Copy link
Contributor Author

niko20 commented May 20, 2023

@dvakatsiienko Hi, I appreciate your support. The issue was "prettier"... thank you.

examples/with-facebook-pixel/app/page.js Outdated Show resolved Hide resolved
examples/with-facebook-pixel/app/readme.txt Outdated Show resolved Hide resolved
examples/with-facebook-pixel/next.config.js Outdated Show resolved Hide resolved
@ijjk
Copy link
Member

ijjk commented Jun 15, 2023

Allow CI Workflow Run

  • approve CI run for commit: bb557bd

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

@niko20 niko20 force-pushed the facebook-pixel-example-app branch from d3cdd85 to bb557bd Compare June 15, 2023 03:54
@niko20 niko20 requested a review from leerob June 15, 2023 03:57
@kodiakhq kodiakhq bot merged commit 29bd098 into vercel:canary Jun 15, 2023
32 checks passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
examples Issue/PR related to examples locked
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants