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

[Analytics] env property not reporting via tessen #339

Closed
roadlittledawn opened this issue Apr 7, 2021 · 3 comments · Fixed by #386
Closed

[Analytics] env property not reporting via tessen #339

roadlittledawn opened this issue Apr 7, 2021 · 3 comments · Fixed by #386

Comments

@roadlittledawn
Copy link
Contributor

Description

Each site can specify properties to track for a tessen.page() call. Since each site reports all data for any environment it's running in, we want to be able to distinguish prod from other envs. It looks like the env is resolved as expected but the function getProperties() (which is supplied via a site's gatsby-config.js doesn't seems to set it inside of trackPageView()

Steps to Reproduce

Expected Behaviour

Screen Shot 2021-04-07 at 10 52 30

Relevant Logs / Console output

Example of raw data reported currently
Screen Shot 2021-04-07 at 10 51 26

@jpvajda
Copy link

jpvajda commented Apr 8, 2021

I'm going to add this to sprint 2 as I really would like to get all of our analytics issues sorted and resolved so we can focus on other things. @zstix any thoughts?

@roadlittledawn
Copy link
Contributor Author

we could also add an option in each sites' gatsby-config.js to disable page view tracking for non-prod envs too (a la the tessen doc), FWIW. but i still think it would be good to get the path and env properties to be sent along with the page view data.

@moonlight-komorebi
Copy link
Contributor

moonlight-komorebi commented May 6, 2021

haha. sorry for all the time on this. in the end, got a simple pr out for this.

most of my time was spent researching what is wrong / why this isn't working. it looks like getProperties is getting dropped. an initial search lead me to believe that functions passed as parameters to plugin options were getting dropped during build time, but im not confident in the end as to what the cause is. in any case, the fix is pretty straightforward and simplifies things overall.

links for reference:
https://spectrum.chat/gatsby-js/general/defining-a-plugin-option-as-a-function~42c75d64-0e25-467f-882a-197bfd528a11
gatsbyjs/gatsby#14199
gatsbyjs/gatsby#13440

update: it looks like the last link has the answer / heart of this problem defined exactly.
Note that plugin options of gatsby-ssr.js and gatsby-browser.js get stringified by Gatsby, so they cannot be functions.
since we are utilizing the options for our tessen calls in gatsby-browser.js, we are running into this.

@zstix zstix closed this as completed in #386 May 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants