We will focus on setting up content substitution through GTM. If you have never work with the service before, read the article “Google Tag Manager Basics” . It will help you understand the basic concepts.
Install the GTM container on the site and check if it works correctly. Check out the official instructions and use the Chrome extension to make sure Tag Manager is connecte successfully. If everything is done correctly, the corresponding tag will be displaye in the interface.
Dynamic substitution is configure in several steps. We’ll need a parameter in the URL that we can bind to, a condition for the tag to fire, and an updatd title.
Create a new URL type variable and fill in the settings as in the screenshot. Create a variable of type “Lookup table”. Select the variable create in the previous step and fill in the rows according to the data from the table creat earlier. Create a pageview Jamaica Email List type trigger and fill in the settings as in the screenshot. Headers will change if the content parameter is present in the URL. Otherwise, the original content will be preserve. Create a “Custom HTML” type tag. In our case, the page title is style using the h1 tag. We will insert a JS code that will look for it and change the value if there is a given request in the URL. The fragment code is available below the list.
Phone number change
- Test the script by going to the site by entering any “utm_content” value creat earlier.
- Remove the parameter from the request and check if the default header is shown.
Similarly, you can change the phone number. Any arbitrary UTM tag term will work as an anchor element.
- Follow the first 3 steps from the previous instructions. Do not forget to specify other names for the elements you create. Create a “Custom HTML” type tag. Use the 2nd code snippet from the previous instruction with binding to the element selector. Add the selector to your site’s page source code if it hasn’t already been set. Publish the update version of the container to the site. Check the script.