If you are tracking your spouse through their smartphone, you may be opening yourself up to potential criminal prosecution. It really depends on how how you came to access their location. For example, if you had to hack into their phone, which we don't recommend, if you had to hack into their phone in order to initiate the tracking, then at that point you have broken the law. There is case law that has come out that says that each spouse has a reasonable expectation of privacy when it comes to their personal cell phones. Not only is that their own personal device, there usually is some sort of password that's connected to that device.
And if you access their phone using the password without their permission or initiate tracking software on their phone without their permission, you are breaking the law. And be forewarned, criminal courts can use information that comes out in a family law case, either in a hearing, in testimony or a trial in order to prosecute you for that. If you are inclined to track your spouse, there are other ways to legally do it and you should talk to your attorney about those options.