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

feat: adding page view conditional #107

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

CaioSilvaDti
Copy link

No description provided.

@sonarcloud
Copy link

sonarcloud bot commented Jul 3, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@revolunet
Copy link
Member

Thanks, looks great;

Dont you also want to disable the initial trackPageView event ? (line 91)

Could you please :

  • check the style ? yarn lint --fix should fix it
  • add an example usage in the README
  • add a unit test ?

maybe something like :

  test("should not trackPageView if disabled", async () => {
   init({ siteId: "42", url: "YO", trackPageView: false });
   window._paq = [];
   push(["trackEvent", "kikoo", "lol"]);
   Router.events.emit("routeChangeStart", "/path/to/hello?world");

   return new Promise<void>((resolve) => {
     expect(window._paq).toMatchSnapshot();
     resolve();
   });
 });

The snapshot should only contain the push event and not the pageView

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants