Registering a New Customer

Associating a Visitor with a Recognized Customer - Registering a New Customer

Step 1

In the Trigger section of Google Tag Manager:

  • Create a custom trigger and name it, set_user_id_trigger.
  • Set the Trigger Type to Custom Event.
  • Set the Event name to set_user_id.
  • Set "This trigger fires on" to "All Custom Events".

Step 2

In the Tag section of Google Tag Manager:

  • Create a new tag and name it, set_user_id_tag.
  • Set the type to Custom HTML.
  • Set the firing trigger to set_user_id_trigger.

Step 3

  • Go to the Custom HTML field for set_user_id_tag:

  • Paste in this code:
<script>

// The SDK_ID refers to the unique customer ID used by your website to identify registered customers/users. 
var sdk_id=document.getElementsByTagName('meta').sdkid.content;
console.log('Inside SetUserIdTag= '+sdk_id);

// Only call the setUserID() if registered / identified customers **is not** empty, null, unidentified. 
// SDK_ID: (string, required)

if(sdk_id != '') {
	optimoveSDK.API.setUserId(sdk_id);
}

</script>

Note:
Once again, please note that you'll need to edit this code to reflect your particular implementation (you won't necessarily be using the meta tag to access the sdk_id).

Step 4

  • Save the set_user_id_tag tag that you just created.
  • Click Preview to check the changes on your site (in Preview mode).