Getting User ID field into output URL after sub

Hey everyone,

Trying to implement and trying to figure out how to get INF to pass the User_ID along in the URL. Here are the instructions:

You’ll have to make the following addition:

In the above example code, we hardcoded uid to 123456 for ease of explanation, however this value will have to be populated dynamically for each user, for each page hit. To do this you’re going to have to programmatically retrieve the Contact ID from Infusionsoft and insert it in that place. And remember, you’ll only insert this red section of code if you have a User ID available. As an example, if you had a membership site that users log into, and that site was written in PHP, your code to add that section in may look like the following.

<?php if ($_SESSION['loggedin']) { echo ", 'userId': '" . $_SESSION['userid'] . "'"; ?>

It’s important to understand that if you’re going to enable the User ID inside Google Analytics, you have to be inserting it on all your pages.

So we have no issue retrieving the Order ID from the thank you pages, but I don’t know how to retrieve the User ID (Contact ID). Anyone have any experience with this?