Google Tag Manager
You can use Google Tag Manager (GTM) to add the Pirsch snippet to your website.
- Click on Tags and New in your Google Tag Manager account
- Enter a name for the tag and click Choose a tag type to begin setup.
- Select Custom HTML and paste the Pirsch snippet (from the domain setup into the HTML field and activate document.write.
- Next click on Choose a trigger to make this tag fire and select All pages (or filter the pages you want to use the script on)
- To finish the setup, click Save, Submit (top right corner) and Publish.
After you finished the setup, you can test the integration as described [here] (/get-started/frontend-integration#test-the-integration).
Should GTM strip the parameters from the snippet. You can try dynamically creating and embedding the snippet.
Considerations When Using the Tag Manager
There are a few things to keep in mind when using the Google Tag Manager:
- GTM adds extra complexity to your site. The Pirsch snippet is very lightweight and simple, adding any of the extra configuration options may affect how the snippet triggers. Please check that the page hits are firing correctly from the browser console.
- GTM is blocked by many adblockers and browsers (as is Google Analytics), so using the snippet directly (or even better, using our backend integration) is more reliable.
You can use the template provided by Markus Bärsch for easy integration. Instructions can be found on GitHub.