Google Ads Conversion Tracking - Custom Headers Plugin in Dashboard?

OJS 3.3.0.6

We use the “custom header plugin” to add our google tracking cookie to our website. However, it seems that once you enter the dashboard, OJS ignores this plugin. So, when we want to add a conversion tracking cookie on the “submit” page, it is not recognized because the header plugins are not loaded.

Are there other ways to do this, or a way to get the custom headers plugin to apply to the dashboard pages as well?

Hi @guitman444

Yeah, the custom header plugin only loads its content on the front pages. If you want to include JS on the workflow pages you’ll probably need to modify the actual templates for those pages. You might have success with editing lib/pkp/templates/layouts/backend.tpl. That is an untested suggestion however.

Cheers,
Jason

1 Like

Ah interesting. I have a child theme used to modify TPL files for the frontend, but trying to not modify core OJS files. I may try as a test, but it sure would be nice to have plugins available to the backend some day.

Another idea I had was to redirect the submission button to a “thank you” page outside of the dashboard, and have the tracking cookie load on the thank you page. But, this seems it would also require customizations to the core OJS files.

Any other ideas are greatly appreciated!

Hi @guitman444

Well, if you’re already into building a child theme, you might also consider writing a Generic plugin that hooked into TemplateManager::display (that hook is called whenever a template is displayed) and then examine which template it was. If it was the backend template I mentioned, you could either alter its output or maybe use one of the plugin methods to include new JavaScript. There is some good documentation on the subject:

https://docs.pkp.sfu.ca/dev/plugin-guide/en/examples-styles-scripts

And if you look at the plugin example here you’ll see how the Hook is done, where it’s registered(), etc.

https://docs.pkp.sfu.ca/dev/plugin-guide/en/examples-get-data-template

Cheers,
Jason

1 Like

Ah very good, I will take a dive into this as an option. Thank you!