Module to insert custom Javascript onto pages

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
Noe_'s picture

Hi,

I have a lot of Javascripts on my site, VWO, Inspectlet, Optimize.ly, Google Adwords conversion, etc.
I know there are modules for each and everyone of these, the problem is the the developer (me) must download these, install them, check into Github, the whole get this online.

What I would want is, people from the marketing department to do this themselves.
This not only speeds up the development time, it also speeds up the site, because all those modules are not necessary.

How does the community feel about such a shortcut. Should I invest time in making such a thing, or is there already something like this.

I would really like some feedback on this before I start coding.

Thanks,
Noë

Comments

There are several solutions

arpieb's picture

There are several solutions already out there for varying degrees of injection and control over who can inject what, where:

If you can't find what you need there, you're probably going to have to roll your own or designate a block they can edit that gets placed on pages via context for finer-grained control.

It seems js_injector is just

Noe_'s picture

It seems js_injector is just what I need.

Thanks a lot!

You might also consider

greggles's picture

You might also consider Google Tag manager or one of the similar tools where tags are managed externally to your site.

Thanks, Google tag manager

Noe_'s picture

Thanks, Google tag manager works like a charm.

Be aware of regression errors.

nico.knaepen's picture

Hi,

We too are facing a similar issue with front-end developers that require a quick way to apply custom css or javascript on onepagers.
Because we where making use of the context module for all our sites, we suggested to make use of the context_addassets module. This module has the flexibility to add css or javascript coming from the theme, module or from a user-defined path.

https://www.drupal.org/project/context_addassets

This flexible way however has it's downside. It is possible to cause errors on a production environment, where no testing is required on a test environment.

Just be aware of this.

Regards,

Nico