Embed Salesmanago code into a Grav website

Hi there,
Does anyone here know the easiest and best way to embed Salesmanago code into a Grav website.

Together with the Script I got the following description from Salesmanago:

“To implement your code just copy and paste it into your website’s source code,
before the end of section”

Any ideas?

Hi @gaatec, in general this code (JavaScript I am assuming) could be added to one of the Twig files of your current theme. In order to not get this possibly removed when a theme update happens you should first make an inherited theme: https://learn.getgrav.org/themes/customization#theme-inheritance

If you provide the name of the theme you are using I might be able to give you more specific info.

1 Like

Hi there, and thanks a lot for replying.
I am using the Clean Blog v1.4.2 theme

Best Reg.
Goran

Are you trying to add a contact form within an iframe? If so, you should be able to do this by editing the template file contact.html.twig within the folder user/themes/clean-blog/templates/.

In the above file look for this:

    <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
        {{ page.content }}
        {% include "forms/form.html.twig" with { forms: "contact-form" } %}
    </div>

And try to replace the code between the two div tags with your SALESmanago iframe code:

    <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
        <iframe src=""></iframe>
    </div>

Hi again,
I simply want to add the Salesmanago code to every page, so that Salesmanago can track the visits, etc.

In the Salesmanago description, they ask me to add the code before the end of the /body section.
The code is indeed Javascript.

Ah, a-ok for that you could want to add the JavaScript to the base.html.twig file in the folder `user/themes/clean-blog/templates/partials’

There, scroll down until you see this…

        {% block bottom %}
        {{ assets.js() }}
    {% endblock %}
 </body>
</html>

Then add your JavaScipt just before the end of body tag, like this:

        {% block bottom %}
        {{ assets.js() }}
    {% endblock %}

    PASTED CODE HERE

 </body>
</html>

Let me know if that works for you.

1 Like

Excellent,
Will give it a try and let you know how it work.

Thanks a lot Paul, highly appreciated.

Reg.
Gøran

1 Like

Hi again Paul,
Your suggestion did indeed sort this out for me.

Thanks a lot, couldn’t have done this without your help.

Reg.
Gøran

1 Like