Feature/page view adding segment properties#6
Feature/page view adding segment properties#6wethu wants to merge 3 commits intosegment-integrations:masterfrom
Conversation
test/index.test.js
Outdated
| it('should push "viewed_page"', function() { | ||
| analytics.page(); | ||
| analytics.called(window._veroq.push, ['trackPageview']); | ||
| analytics.called(window._veroq.push, ['track', 'viewed_page', {}, { source: 'segment' }]); |
There was a problem hiding this comment.
page.properties() returns the current page call's properties object. By default our .page() call collects some context page metadata:
{
"path": "/context.html",
"referrer": "http://localhost:9876/?id=70213249",
"search": "",
"title": "",
"url": "http://localhost:9876/context.html"
},
☝️ is what gets set inside the test suite. So you should change the analytics.called() method to include these properties!
There was a problem hiding this comment.
Thanks for that,
I was able to fix the problem by passing in the referrer to #page(), this means the example will always have the same id parameter.
Let me know if theres a better way to accomplish this!
Codecov Report
@@ Coverage Diff @@
## master #6 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 1 1
Lines 28 28
=====================================
Hits 28 28
Continue to review full report at Codecov.
|
|
@hankim813 Thanks for the review! I'm currently triple checking with our Project Manager about the backwards compatibility aspect. And will follow up soon! Thanks again :) |
Hey People,
We're changing the properties tracked along with page views. I have some implementation here which works, however I'm having trouble stubbing the properties passed into
page.Thanks!