Integrating Doofinder using the Google Tag Manager (GTM) allows you to manage your script without touching your site’s HTML code.
To integrate it this way, follow these steps:
- Create your GTM account or log in if you already have one.
- Select the workspace where you’re going to add the new script.
- Select Add a New Tag to configure Doofinder’s script.
- On the next screen, provide the following:
- A name for the new tag, for instance: Doofinder Script V7
- Inside the Tag Configuration, ensure that the tag type is Custom HTML and paste your script for Doofinder inside the HTML editor, including the surrounding script tags.
- Then under Triggering, you may choose when the script must be activated. Note that the recommended option is All Pages. This way, Doofinder will be available on all pages.
- Once done, press Save and your HTML tag will be created.
- Back in your GTM dashboard, press the Submit button in the top right corner.
- Next, select Publish and Create Version, then provide a relevant version name and description for the records, choose the environment where you want to publish the changes and press the Publish button in the top right corner.
- You will be able to see the details of the latest published version from the dashboard. The Doofinder layer should be working as soon as the information reflects the latest version.
Custom templates and GTM
It is possible to customise Doofinder’s layer templates in Google Tag Manager.
To do this, you will need to add the custom templates through Doofinder’s admin by editing the script. This is because GTM does not allow the use of Mustache JS templates inside the tags, so you cannot directly paste them as you did with the script earlier on.
Therefore to customiSe the template and GTM, use the following steps:
- Select the search engine you want to work on.
- Go to Configuration > Doofinder Layer > Setup.
- Click the Edit Script button.
- Add your custom template tags before the layer script and modify the script to use them if necessary.
- Save your changes.
Now you only have to publish a new version of your Doofinder layer tag in GTM, with much simpler content such as this:
Remember, the placeholders in the URL must be replaced by actual values:
- [zone]: Use
us1depending on your search engine’s zone.
- [hashid]: Your search engine’s unique ID.
If you publish your layer this way, the actual script will be served by Doofinder instead, so you will have to perform any modifications directly from Doofinder’s Admin. No further action in GTM will be required.
Should you encounter any problems, please contact email@example.com
Last Updated: July, 2021