Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Plugins

Embed Salesmanago code into a Grav website

Solved by Paul Hibbitts View solution

Started by Goran 8 years ago · 7 replies · 1007 views
8 years ago

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 </body> section"

Any ideas?

8 years ago

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
8 years ago

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

Best Reg.
Goran

8 years ago

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:

TWIG
    <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:

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

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.

8 years ago Solution

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...

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

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

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

    PASTED CODE HERE

 </body>
</html>

Let me know if that works for you.

👍 1
8 years ago

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

Thanks a lot Paul, highly appreciated.

Reg.
Gøran

👍 1
8 years ago

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

Suggested topics

Topic Participants Replies Views Activity
Plugins · by Rene, 1 week ago
2 43 1 week ago
Plugins · by Xavier, 4 weeks ago
2 53 4 weeks ago
Plugins · by Luka Prinčič, 7 years ago
3 1179 1 month ago
Plugins · by Sebastian van de Meer, 1 month ago
1 47 1 month ago
Plugins · by PIERROT Alain, 2 months ago
3 72 2 months ago