I want tracking a single page and anonymize IP. There is only one URL and 5 sections.
I'm not sure, if I can combine the function like this:
ga('set', 'page', '/#first', '/#second', '/#third', 'anonymizeIp', true);
I want tracking a single page and anonymize IP. There is only one URL and 5 sections.
I'm not sure, if I can combine the function like this:
ga('set', 'page', '/#first', '/#second', '/#third', 'anonymizeIp', true);
I am really not sure what you are asking, but your example code will not work.
The syntax specifies that you can either pass a key/value pair to set or an object with different key/value pairs. So while with the object syntax you could set values for page and anonymizeIp at once:
ga('set' {
'page':'/my/path',
'anonymizeIp':true
});
you could not set multiple different page paths at once. I am not sure why you would want to do this in any case.
I think what you might really want (if I'm wrong you have to phrase your question more clearly ) is virtual pageviews - i.e. record a pageview every time somebody uses your in-page navigaton between the segments. Instead of setting the names in advance you would add a click event to each navigation item and pass in a custom page path to a pageview call:
<a href="#section3" onClick="ga('send','pageview','/section3')">Section3</a>;
(note that Google does not like the hash mark, it's better to use proper paths). Every click on that link would appear on the behavior report as a call to the url "/section3".
You'd need to do a call to "set" for the anonymizeIp feature before any pageviews are tracked.