Deploy Second Tag and Trigger for SPA Websites

  • Updated

Context

If your website is a single-page application (SPA), you must set up a second trigger in Google Tag Manager (GTM) to fire the Demandbase tag when there is a URL change. See Google’s article Components of Google Tag Manager.

Steps

Create a Tag

  1. In GTM, create a tag.
  2. For tag type, select Custom HTML.
  3. Go to the HTML box and enter the following:
    <script type="text/javascript">
    //ensures Demandbase API is fired on each URL change 
    Demandbase.IpApi.get()
    </script>
  4. Go to Advanced Settings > Tag Firing Option and select Once per event.
  5. Click Save.
    GTM Tag.png

Create a Trigger

  1. In GTM, create a trigger.
  2. For trigger type, select History Change.
  3. Go to This Trigger fires on section and select All History Changes.
  4. Click Save.
    Trigger+Example+%282%29.png

Was this article helpful?

0 out of 0 found this helpful