Substitution of a key phrase into the site title via GTM – instructions – ppc.world

In this article, we will analyze a solution for Google Tag Manager, which will allow substituting the utm_term value in the site title.

How and why are we going to do this? We will take the value of the {keyword} dynamic parameter, that is, the key phrase that was used to navigate from a Yandex.Direct or Google Ads ad, and substitute it into the site title. So, we will increase the relevance of the landing page to the user and will probably increase the conversion rate. At least, we see such dynamics among our clients.

Preparing variables

Substitution of the title on the site will occur when the utm_multi parameter with the ON value appears in the url. Why is this? This will make it easier, if necessary, to selectively enable or disable spoofing for specific ads, groups, or campaigns. That is, at any time you can remove this parameter from the link and the substitution will stop working – this is practical.

Create a variable in GTM that will take the value of the {keyword} dynamic parameter – in Direct this is used for utm_term. It is possible to get this value in GTM by creating a variable of the URL type, with the component type “Request” and the request key “utm_term”:

variable

Now let’s create a variable of the URL type with the component type “Request”, the key will be a specially invented parameter “utm_multi” (you may have another one):

variable

In the future, the value “ON” for this variable will be a trigger for the tag that is so important.

Read also:   15 ideas for the site "How to improve the site and get closer to the Clients"

The tag that’s so important

This will be a custom HTML tag that will contain the following script:

<script>
 jQuery('h2').contents().replaceWith('{{utm_term}}');
</script>

where {{utm_term}} is the variable that we created earlier;

h2 – the title that will be replaced.

In general, the element for substitution may differ depending on the project and the tasks that need to be solved. The identification of the element that needs to be replaced is as follows: move the mouse over the element, press the right mouse button and then – “Check element”.

For example, if it were necessary to replace the text on this button (see the picture), then in the script instead of h2, the button would appear:

button

<script>
 jQuery(‘button’).contents().replaceWith('{{utm_term}}');
</script>

Important: all elements with the tag specified in the script will be replaced – all h2 (or all buttons). You can set the order using a selector, which will limit the search scope of an element based on its position:

  • : last – to select the last item:
    <script>
     jQuery(‘h2:last’).contents().replaceWith('{{utm_term}}');
    </script>
    
  • : first – to select the first element:
    <script>
     jQuery(‘h2:first’).contents().replaceWith('{{utm_term}}');
    </script>
    
  • : gt () to select the item at the given index.

    Here, the first element has an index of 0, that is, to apply only for the second h2, you will need to use index 1:

    <script>
     jQuery(‘h2:gt(1)’).contents().replaceWith(’{{utm_term}}’);
    </script>
    

All about the tag script. It remains to add a trigger on which this script will be activated. According to plan – when utm_multi will value ON… We make a trigger of the “Pageview” type – “Some pageviews”, for which the variable “multi“Will equal”ON“:

Read also:   Rules for effective remarketing in Google Ads: reviewing the basics - ppc.world

trigger

Done. It remains to publish the whole thing, comb the keywords in advertising campaigns and add & utm_multi = ON to the ad links.

Subscribe to receive useful paid traffic content

0
Top 9 Figma plugins for working with graphics and images Top 9 Figma plugins for working with graphics and images

No Comments

No comments yet

Leave a Reply

Your email address will not be published. Required fields are marked *