Closed ndhoule closed 8 years ago
From @ianstormtaylor on June 12, 2014 17:0
Interesting, my understanding is that it maps best to our name
and category
for pages. From their example, they have a Content Grouping called "Clothing" that has a subgroup called "Men". I think that would map nicely to:
analytics.page(category, name);
And then in the Segment interface they would make a mapping of:
category -> contentGroup#
For example:
'Clothing' -> 'contentGroup1'
And then with this call:
analytics.page('Clothing', 'Men');
That would translate to...
ga('set', 'contentGroup1', 'Men');
ga('send', 'pageview');
How does that sound? Not sure how we should prioritize this, since it seems like only one or so have asked for it so far?
From @DirtyAnalytics on June 12, 2014 17:2
It sounds ok, but the page name is a problem I think. I agree that's how this should be mapped, but we are setting the page title in GA to name
which probably isn't the best idea. More details here: https://github.com/segmentio/analytics.js-integrations/issues/194
If we changed that I'd be down for the name
and category
going to content group and grouping.
From @pmmaga on June 12, 2014 18:25
Hi @DirtyAnalytics!
Thanks for creating the issue.
I think that the direct interpretation of category
may be helpful but won't cover all the cases as, for example, forcing secure connection on GA using
ga('set', 'forceSSL', true);
I believe that the issue lies with the fact that the analytics.ready
is raised only after the first analytics.page()
.
I really need this to work also and was expecting the following code to do the trick, but it doesn't.
analytics.ready(function () {
window.ga('set', 'contentGroup1', 'Marketing');
});
analytics.page();
@ndhoule Is there a way to work around this?
For those interested, I worked up an elegant work around for this which still uses the page call, but just doesn't pass it to GA via Segment:
analytics.on('page', function (event, properties, options) {
ga('set', {
contentGroup1: 'Marketing',
title: options.name || options.title,
location: options.url,
page: options.path
});
ga('send', 'pageview');
ga('send', 'event', {
eventAction: 'Viewed Home Page',
eventCategory: 'All',
nonInteraction: true
});
});
analytics.page('Home', {}, {
integrations: { 'Google Analytics': false }
});
From @DirtyAnalytics on June 12, 2014 16:41
Here's the GA docs.
When these are set directly through GA the code looks like this:
And here's how I think it should work in Segment...
When people call this:
Becomes:
There are 5 content groupings slots available in GA, grouping is the very top level category, examples would be:
Then there are content groups which the user defines as a string and for that reason there can be as many as they want, groups always fit under a content grouping, here are some examples that would fit in the groupings above:
Let me know if this makes sense @ianstormtaylor @yields @calvinfo @lancejpollard
Also - let's only worry about supporting the GA universal tracking method.
Copied from original issue: segmentio/analytics.js-integrations#210