angulartics / angulartics-google-analytics

Google Analytics plugin for Angulartics
MIT License
133 stars 86 forks source link

Fix for broken Multi GA Accounts #97

Closed harshapat closed 7 years ago

harshapat commented 7 years ago

Multi GA Accounts were broken. The AccountNames were appending one fully formed account names. AccountNname should append the command been passed send/set etc..,

DanWilkerson commented 7 years ago

Hey there, it sounds like you've run into some issues with running multiple accounts; the proposed code doesn't appear to me to be the right path, could you explain a bit? From what I can tell, there should be no difference between the code in the PR and what is there right now, as both arrays are identical - commandClone is just a copy of commandArray.

I've tested the current code with multiple accounts without any issues, so I'd love to know more about the problem you're running in to!

harshapat commented 7 years ago

Yes, the account names get appended. For Ex: If 1st Account Name is "base" 2nd Account Name is "client"

The angularities sends "base.send" and on second iteration it becomes "client.base.send". As the line commandClone[0] = accountName + '.' + commandClone[0];

just appends the name to existing one, which is the issue.

DanWilkerson commented 7 years ago

Now I see the problem, thank you. Can you please increment the patch number by one in the package.json file and then run "npm run build" and commit those changes as well? Then I can merge in your request.