Pulse in Angular App
scottjustin5000
Posted on
Nov 21 2015
I'm using Pulse in our Angular App. Things work okay when I set up everything in the index.html. For Example:
rg4js('apiKey', 'MYAPIKEY');
rg4js('options', {excludedHostnames: ['\.local'], ignore3rdPartyErrors: true, allowInsecureSubmissions: true});
rg4js('attach', true);
rg4js('enablePulse', true);
This will initialize everything fine. This all happens at start-up, prior to login. However, after the user logs in (once we're inside of the angular app and an angular controller specifically) I attempt to set the user:
rg4js('setUser', {
identifier: data.email,
email: data.email,
firstName: data.fname,
fullName: data.fullname
}); but nothing happens, (i.e. all reported events are still being attached to the original anonymous user). That is an issue, we need user data to be tracked as well. If I try to move all the code "further" into the app (e.g. inside the login controller) rg4js does not seem to get initialized...no events end up in the pulse dashboard. Is this a SPA issue, and an Angular issue, or am I doing something wrong?
Anditthas
Posted on
Jan 05 2016
It works for me. Try removing
rg4js('attach', true);
That's the only thing which differs my implementation from yours
Cheers