Jump to content

Where to add Javascript snippet on homepage


Recommended Posts

Hi there,

 

I'm trying to add a Javascript snippet to insert an onboarding overlay to the homepage, but I can't seem to get it to work.  Attached is a screenshot of the text to be added.  Is anyone able to tell me exectly where I should add it?

 

Thanks

Screenshot 2020-05-30 at 16.17.41.png

Link to comment
Share on other sites

Thanks Daniel - ideally, I only want the code on the homepage (I've created in Pages).  what's the best way to add this snippet to the one page?

 

18 hours ago, Sonya* said:

You can use this plugin 

 

 

Link to comment
Share on other sites

4 hours ago, Daniel F said:

Just add it to the analytics setting, which can be found in your ACP on the System => Analytics page.

He has to include it before the <body>-tag. If he changes the location of JavaScript in the theme, then the script will fail. This will not happen with 3rd party plugin 😉

4 hours ago, gaapgeek said:

I only want the code on the homepage (I've created in Pages).  what's the best way to add this snippet to the one page?

You can limit the script to one page only:

{{if \IPS\cms\Pages\Page::$currentPage == 'YOURPAGE'}}
your script
{{endif}}

Use this either in Analytics field or with the 3rd party plugin. 

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...