Reputation: 544
I am trying to configure google analytics in my angular app, and I have found that when using the 'Send' method I can see the tracking pixel in my network tab, yet I cannot see the pixels firing when using the 'Set' method. I am not seeing an error of any kind and the google troubleshooting docs don't provide much insight, any help is greatly appreciated. Here is a sample of two pixels I have:
ga('send', 'pageview', '/about');
this works fine, however:
ga('set', 'page', {
title: 'About',
page: '/myinfo/about'
});
Does not fire at all. I am not sure what I am doing wrong here.
Solution:
ga('set', {
title: 'About Page',
page: '/pages/about.html'
});
ga('send', 'pageview');
}
Sends the proper payload. Thanks to Philip Walton for the troubleshooting.
Upvotes: 0
Views: 39
Reputation: 30441
You have the syntax wrong, it should be:
ga('set', {
title: 'About',
page: '/myinfo/about'
});
Here is the documentation on the set command:
https://developers.google.com/analytics/devguides/collection/analyticsjs/command-queue-reference#set
And here's a guide that explains how to get and set data on a tracker object:
https://developers.google.com/analytics/devguides/collection/analyticsjs/accessing-trackers
Upvotes: 2