Support

Home Forums Event Espresso Premium Is there a way to insert Tracking Codes in within the tag?

Is there a way to insert Tracking Codes in within the tag?

Posted: July 28, 2013 at 5:45 pm


womenwithaltitude

July 28, 2013 at 5:45 pm

I have a tracking code, but I want to monitor its conversion. Is there a way to insert tracking code to the event itself within the <head> tag? I can’t find a way to do it. Any suggestion?


Josh

  • Support Staff

July 30, 2013 at 3:28 pm

Here’s one suggestion that might help: There’s a WordPress action hook that lets you add code to the head of the document. Along with that, there’s a hook in Event Espresso’s registration_page_display.php template that can be used to make it so the tracking code gets added to *only* the registration page.

Here is some example code that shows how to make this happen:


womenwithaltitude

July 30, 2013 at 8:39 pm

@josh.. Do you have a step by step instruction on how to do the workaround on this? Another question, when I add a code, is there a way to just add it in one event only? Sometimes, when you work with the hooks, other similar pages also gets the custom tracking code.


Josh

  • Support Staff

July 31, 2013 at 8:22 am

The steps to add the above code are as follows:

1) Create a file called custom_functions.php in your /wp-content/uploads/espresso/ folder.
2) Add the functions to it.

To make the tracking code get added to one event only you can add a check. Here is a modified version of the above gist that check to see if the event_id is 15. If it’s 15 it will load the tracking code, if it’s not event #15, it will not load the tracking code.

The action_hook_espresso_social_display_buttons hook only runs in one place in Event Espresso: the registration page template, no where else. This makes it an acceptable hook to use when you want to only run code on a registration page because it will not run anywhere else on the website.

The support post ‘Is there a way to insert Tracking Codes in within the tag?’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso