Has anyone used Google Analytics with Communities before?
There's a cool event called forceCommunity:analyticsInteraction that lets you send custom events etc. https://developer.salesforce.com/docs/component-library/bundle/forceCommunity:analyticsInteraction/specification
Technically it says you can only use it with the following types 'event', 'social', 'exception', 'timing', but I've found it does actually work with the 'pageview' type as well, but it won't accept the custom 'page' attribute that is specified here https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#hitType
It always just sends the current page url.
var analyticsInteraction =
$A.get("e.forceCommunity:analyticsInteraction");
analyticsInteraction.setParams({
hitType : 'pageview',
page : '/new-page.html'
});
analyticsInteraction.fire();
Does anyone know how I could get it to send a custom page url?
EDIT: We've got a parent Lightning Component that acts as a sort of virtual navigation between different views.
event
,social
,exception
,timing
. Even if It temporarily works you can't rely on it long term! – codeyinthecloud Dec 11 '18 at 1:41