jwhelan,
Thanks for the further explanation. Normally, doing Javascript inside PHP is very difficult. The PHP code can do redirects and other things that don't print to the screen (or actively erase what's previously been echoed out). However, I just did some testing and found something that might work just great for you, and it's simple too!
Since you basically want to track whenever that string is displayed, just edit the string and put the text in there
Edit the file /libraries/en_GB/en-GB.com_jlinked.ini. Find the string:
COM_JLINKED_MAP_USER_SUCCESS="LinkedIn profile successfully connected."
And update it to:
COM_JLINKED_MAP_USER_SUCCESS="LinkedIn profile successfully connected.<script type='text/javascript'>ga.track('blah');</script>"
The Google track code isn't correct, I just made that up. However, I tested doing that with some other Javascript and it seemed to work fine. Please make sure that you do *not* use double-quotes, only single quotes. Other than that, you should be good!
The other benefit of this is that, since it's in a language file, you're not changing the main component.. so you don't need to remember some obscure file you once edited.
Hope that helps, but definitely keep us posted. Never thought about doing JS in a language string, and pretty surprised/happy to see it works!
Alex