Deploy with Google Tag Manager

Deploy via Google Tag Manager (GTM)

Get your private data stream endpoint url

Before digging into the integration of the agent you need to get your private data stream endpoint url we will use to push our agent data. Ask your dedicated ScaleDynamics account team to get one. This URL is referred to as <PRIVATE_URL> in the following documentation.

Note that this url has been generated only for one report and you must treat it as confidential and do not share it publicly.

Steps to deploy with GTM

Follow these steps to integrate the ScaleDynamics agent across your website using GTM.

Step-by-Step Implementation Guide:

  1. Create a New Tag: Log in to your Google Tag Manager* container. Navigate to the Tags section in the left-hand menu, then click the New button in the top right corner.

  2. Configure the Tag Type: Click anywhere in the Tag Configuration box, then select Custom HTML from the list of available tag types.

  3. Insert the Script: Paste the provided HTML script directly into the HTML text area.

<script 
  type="module" 
  async
  src="https://agent.scaledynamics.com/2/sd-agent.js">
</script>
 
<script>
  window.sdAgent = window.sdAgent || {
    _q: [],
    send: function() {
      window.sdAgent._q.push([Date.now(), window.location.href, arguments]) },
    config: function () { window.sdAgent._c = arguments },
  };
 
  sdAgent.config({
    // Replace <PRIVATE_URL> with your actual agent URL.
    endpoint: '<PRIVATE_URL>',
  });
</script>
  1. Define Triggering Rules and Exclusions: Scroll down to the Triggering box to define where the script should and shouldn't run before saving.
  • To run on all pages: Click within the Triggering box and select the predefined All Pages trigger.
  • To exclude specific pages (Optional): If you want to prevent the agent from firing on certain pages (e.g., checkout or sensitive areas), add the exception now:
    • Click Add Exception directly below your All Pages trigger.
    • Click the + icon in the top-right corner to create a new exclusion trigger.
    • Choose Trigger Configuration> Page View.
    • Change This trigger fires on to Some Page Views.
    • Set your exclusion criteria, for example: Page URL | contains | /checkout.
    • Name the trigger (e.g., Exclusion - Checkout) and click Save to apply it as an exception.
  1. Save and Publish Changes: Name your tag at the top left of the screen (e.g., ScaleDynamics Agent - Base Script) and click Save. To deploy the container updates to your live site, click Submit in the top-right corner of the workspace, provide a brief version description, and click Publish.

Best Practice: Before hitting Publish, click Preview in the upper right corner to launch GTM Debug Mode. This allows you to verify that the ScaleDynamics tag fires correctly on your website without disrupting live user traffic.