Skip to content

Commit

Permalink
feat(TagManager): Sending userId to tagManager
Browse files Browse the repository at this point in the history
Collecting userid from the climb feed and sending it to TagManager
  • Loading branch information
mmmoli committed Apr 21, 2016
1 parent 6d23e66 commit 9bd0ced
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
13 changes: 9 additions & 4 deletions example/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,30 @@ const App = () => {
</TabList>

<TabPanel>
<ClimbView collectionId='56b3759808216f7118fa2c93' Card={ StackedCard } />
<ClimbView collectionId='56b3759808216f7118fa2c93'
Card={ StackedCard }
domain='http://curate.vm-08.graph.uk' />
</TabPanel>

<TabPanel>
<ClimbView collectionId='56b3759808216f7118fa2c93'
View={ RegularSquareView } />
View={ RegularSquareView }
domain='http://curate.vm-08.graph.uk' />
</TabPanel>

<TabPanel>
<h2>List View</h2>

<ClimbView collectionId='56b3759808216f7118fa2c93'
View={ ListView } />
View={ ListView }
domain='http://curate.vm-08.graph.uk' />
</TabPanel>

<TabPanel>
<h2>Column View</h2>
<ClimbView collectionId='56b3759808216f7118fa2c93'
View={ ColumnView } />
View={ ColumnView }
domain='http://curate.vm-08.graph.uk' />
</TabPanel>

<TabPanel>
Expand Down
9 changes: 7 additions & 2 deletions src/views/ClimbView/ClimbView.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ class ClimbView extends React.Component {
this.subscription = Climb.getStream(collectionId, refresh, domain)
.subscribe(items => {
const latestItems = items.slice(0, limit);
this.setState({ items: latestItems });
const userId = items[0].userId;
this.setState({
items: latestItems,
userId
});
});
}

Expand Down Expand Up @@ -55,7 +59,8 @@ class ClimbView extends React.Component {
<div className='Climb__Container'>
<View items={ this.state.items } { ...otherProps } />
<TagManager dataLayer={[{
collection_id: this.props.collectionId
collection_id: this.props.collectionId,
user_id: this.state.userId
}]} />
</div>
);
Expand Down
9 changes: 7 additions & 2 deletions src/views/ColumnView/ColumnView.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ class ColumnView extends React.Component {

this.subscription = Climb.getStream(collectionId)
.subscribe(items => {
this.setState({ items });
const userId = items[0].userId;
this.setState({
items,
userId
});
this.instance.pack();
});
}
Expand Down Expand Up @@ -63,7 +67,8 @@ class ColumnView extends React.Component {
})}
</div>
<TagManager dataLayer={[{
collection_id: this.props.collectionId
collection_id: this.props.collectionId,
user_id: this.state.userId
}]} />
</div>
);
Expand Down

0 comments on commit 9bd0ced

Please sign in to comment.