Jump to content

Welcome, Guest!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

  • 0
veldepatrick

How to add custom code in <header></header>to CMS page?

Question

Hi,

I'm trying to figure out how I can put custom code in the <header></header> section of a CMS page. I need to add a code event snippet for google adwords tracking, in which the event is clicking on a button on that CMS page:

Copy the snippet below and paste it in between the <head></head> tags of the page(s) you'd like to track, right after the global site tag. Then, call gtag_report_conversion when someone clicks on the chosen link or button.

I also don't exactly understand what is ment by 'Then, call gtag_report_conversion when someone clicks on the chosen link or button.' 

Hope somebody knows?

Kind regards,
Patrick

 

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Hi,

I think the easier way for you will be to edit header.tpl file from your theme.

just before the closing </head> tag you can add.

{if $page_name == 'cms'}
  {literal}
  ... the script you received from google .... 
  {/literal}
{/if}

gtag_report_convertion is probably a function that comes with the google code.

so you should call (run/fire) that function on your desire click event (like clicking a url or a button).

you can see samples here: https://support.google.com/google-ads/answer/6331304?hl=en

the 'on_click' part you will have to put in the content of the page (in the cms page editor).

Good luck

Share this post


Link to post
Share on other sites
  • 0

I tried many places and couldn't get it to work.. In the end I used the google module and and was very simple to setup

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...