How can I modify values in the Google Gtag Pixel with Trekkie?

Depending on the content you need replacing you can use the replace function within the {{ content_for_header }}

First you would need to comment it out:

{% comment %}{{ content_for_header }}{% endcomment %}

and directly beneath it:

{{ content_for_header | replace:'originalContent', 'replacementContent' }}

wherein originalContent would be the thing you are looking to replace and replacementContent its replacement

For example, if you wanted to disable the Google Gtag Pixel within Trekkie in order to use your own hard coded scripting you could nullify that variable by doing the following:

{{ content_for_header | replace:'Google Gtag Pixel', 'Null Google Gtag Pixel' }}

if more than one thing needs replacing:

{{ content_for_header | replace:'Google Gtag Pixel', 'Null Google Gtag Pixel' | replace:'Facebook Pixel', 'Null Facebook Pixel' }}

and so forth; this essentially renders that code useless within the “Trekkie” script.

It’s not an ideal solution but it gets the job done.

4 Likes