SkyGlue Visitor Tracking API
SkyGlue enables you to explicitly push a registered user ID to Google Analytics in order to identify the behavior of a specific user.
Step 1: Set up visitor tracking using your backend user ID
SkyGlue automatically tracks visitors using two IDs:
(1) visitor ID (e.g.1491284089.1575990169). This ID is generated based on the Google Analytics client Id using the utma cookie value (in classic GA) or GA client Id (in universal analytics). If you set up cross-domain tracking in your Google Analytics, this ID will remain the same across domains. This ID is based on browser cookie. It is different for different browsers and different machines.
(2) registered user ID (e.g. B1E2DB3). If you set up registered user tracking in your SkyGlue portal, this ID is generated using the login/signup form value the visitor submitted. It is a hash value of the user ID of the field value you specified in the SkyGlue portal. The ID will be the same for the same registered user even if he/she uses a different browser or machine. This ID can be found under event label in Google Analytics.
You can set the value of registered user Id with your own back-end User ID using the following approach: (Please note, Google Analytics does not allow any PII data to be sent to its server.)
To set a registered ID, define a global JavaScript variable “_sg_registeredUserId” anywhere in your web page. It should be a string without space.
The ID is set using a server side language, such as php, asp, python, etc. Below is an example of PHP.
<script type="text/javascript"> //Make sure the visitor is logged in before call the following line to define the global javascript variable. //You can set var _sg_registeredUserId to null if the user is not logged in. var _sg_registeredUserId="<?=$_myRegisteredUserIDValue?>"; </script>
SkyGlue can optionally set the registered user Id as “user Id” in universal analytics and/or a custom dimension. If you want to set them in your account, please contact support by email.
The difference between setting SkyGlue registered user Id vs. setting GA user ID directly using the GA JavaScript API is that you only need to set the registered user ID once on one page using the SkyGlue API and SkyGlue can store it in a cookie and use it in all subsequent pages a user visits. You do not need to set the ID value in all pages. While the GA API does not store the registered user ID in a cookie, you need to set the user ID value in all pages.
Step 2: View visitor activities using your back-end user ID
You can enter the registered user ID into the Registered ID search box on your SkyGlue user report to retrieve the visitor’s click path.