πŸ“‘ Using Google Tag Manager for inserting FT CRM Scripts

If you want to use your Google Tag Manager for injecting the Site Integration Script / Inbox Script on your site you can do that.

1. Create a new user-defined variable in GTM

Google Tag Manager Custom Variable
Google Tag Manager Custom Variable

2. Create a new trigger

Create a "Page View - DOM Ready" trigger. Add additional filters such as url if you want. But it is important that the trigger is based on page vid AND DOM Ready.

3. Create a new tag with below code inside

Don't forget to replace your own values.

Make the tag fire on your "Page View - DOM Ready" trigger.

3. Insert the script in your HTML / DOM

You might already be adding dataLayer variables. If you do so, please append the dataLayer with your sid variable (the custom variable you created in step 1) and add the corresponding value.

If you are not already adding dataLayer variables to GTM you need to include the following before initiating the Google Tag Manager on your page:

And you're done! πŸ‘Œ

Debugging

Test user:

If you want to debug in staging or production environment, you could deploy above script to production with the variable autoInit set to false. With that done, you can manually enable the inbox integration by putting this into the browser developer console:

After doing that the inbox integration will initiate with the sid variable defined. You can change the sid in runtime by setting the sid in the developer console before initiating it, like this:

#Sending demo message

You can send a demo message from the developer console (the script has to be initialized first!):

If you want to you can also set the data in the message yourself, like here:

☎️ Front end inbox actions

If you want to toggle the visibility of the inbox in the front end of your site, you can add this action on your inbox button in the main menu for example:

πŸ‘” Override Styles

If you want to override the styles in the inbox, all styles should be wrapped within the CSS id #fasttrack-crm. That protects your sites CSS and allows you to easily target CSS classes in the inbox. Place a block of CSS above the invocation of the integration script.

Example:

πŸ”š API Endpoints

If you want you can build the front end for the inbox yourself. We list the required endpoints below.

GET /Notifications/v2/user-notifications?{filters}

Lists all notifications for an authenticated user. Use the querystring parameters to filter notifications:

Key

Values

Description

unread-only

true / false

Only return unread notifications

Response

GET /Notifications/v2/user-notification/:ID

Returns notification for the given id

Response

DELETE /Notifications/v2/user-notification/:ID

Marks specific notification as deleted. Deleted notifications won't be returned in endpoint for getting all notifications or endpoint for getting a specific notification.

Response

POST /Notifications/MarkNotificationAsRead

Marks notification as read. Be aware this is a POST request. So you have to provide a post body looking like this:

Request

Response