-
-
Notifications
You must be signed in to change notification settings - Fork 246
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
Allow for better page tracking in segment #75
Comments
You can customize the payload of page views, identity calls, and tracking events with custom plugins For example, if you want all pageView calls to have something specific or keys removed you can use a plugin. Hook into the import Analytics from 'analytics'
import segmentPlugin from '@analytics/segment'
function myCustomPageDataPlugin(userConfig = {}) {
return {
name: 'my-custom-page-plugin',
config: Object.assign({}, userConfig),
pageStart: ({ payload }) => {
// Alter payload before it reached .page calls
return Object.assign({}, payload, {
addThis: 'hello',
addThat: 'goodbye'
})
}
}
}
/* initialize analytics and load plugins */
const analytics = Analytics({
debug: true,
app: 'yolo',
plugins: [
myCustomPageDataPlugin(),
segmentPlugin({
writeKey: 'xyz'
})
]
})
analytics.page() |
Hi @DavidWells thank you for taking the time to reply. I will investigate to see if this will achieve the desired effect. I think I had issues altering the page call to be able to have Page(name, pageData) go through since the Page interface only allows for calling Page (page Data) but let me have a look and see what I can accomplish. Thanks again 👍 |
Hwy @Carl-Meyer any updates here? |
Hi @DavidWells seems like not having the page name param in the sentry preview isn't an issue for us so I didn't end up implementing your solution. Sorry, but thank you for the support. |
Hi there
I was using angulartics2 as an analytics library before switching to analytics. We are sending our analytics to segement.
I hoping to ask if there is a way to send through page data in a better format similarly to how it was when using angulartics2?
Here is what I mean:
Angulartics2
analytics
I like the fact that analytics sends the height and width as well. I have added the name field to the page track call myself which is working fine but when viewing it in the segment debugger it shows as
/recruiting/
instead ofJob Postings
Thanks for the hard work :)
The text was updated successfully, but these errors were encountered: