Integrate using Google Tag Manager
✍️ Using Google Tag Manager for inserting Fast Track 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
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 following code inside
Don't forget to replace your own values.
<script>
window.sid = "{{sid}}"; // REPLACE THIS ONE WITH THE GTM VARIABLE YOU ARE USING
window.fasttrackbrand = 'brandname';
window.fasttrack = {
integrationVersion: 1.1,
autoInit: true,
enableEventTracking: false,
enablePendingRewards: false,
enableCrmIntegration: true,
inbox: {
enable: true,
badgeId: '#inbox-badge', // REPLACE THIS ONE WITH YOUR OWN VALUES (OR REMOVE IT IF NOT NEEDED)
navBarLogo: 'https://via.placeholder.com/150x150', // REPLACE THIS ONE WITH YOUR OWN VALUES (OR REMOVE IT IF NOT NEEDED)
contactEmail: 'info@example.com', // REPLACE THIS ONE WITH YOUR OWN VALUES
termsAboveButtons: false
},
translations: {
recieved: 'Recieved:',
validUntil: 'Valid until:',
questionsTop: 'Questions? Mail us at',
questionsShort: 'Questions:',
deleteMessagePrompt: 'Are you sure you want to delete this message?',
inboxEmpty: 'There is currently no messages in your inbox',
readMore: 'Read more'
}
};
var fastTrackCrmScript = document.createElement('script');
fastTrackCrmScript.async = true;
fastTrackCrmScript.onload = function () {
new window.FastTrackLoader();
};
// fastTrackCrmScript.src = 'https://crm-lib-staging.fasttrack-solutions.com/loader/fasttrack-crm.js'; // THIS ONE IS FOR STAGING
fastTrackCrmScript.src = 'https://crm-lib.fasttrack-solutions.com/loader/fasttrack-crm.js';
document.body.appendChild(fastTrackCrmScript);
</script>
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:
<script>
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
'sid': 'XXX' // REPLACE THIS WITH A PROPER SID!
});
</script>
<!-- HERE WE THEN INITIATE GOOGLE TAG MANAGER SCRIPT! -->
And you're done! 👌
Last updated
Was this helpful?