logo
Welcome to our new AbleCommerce forums. As a guest, you may view the information here. To post to this forum, you must have a registered account with us, either as a new user evaluating AbleCommerce or an existing user of the application. For all questions related to the older version of Gold and earlier, please go to AbleCommerce Gold forum. Please use your AbleCommerce username and password to Login. New Registrations are disabled.

Notification

Icon
Error

Options
Go to last post Go to first unread
ray22901031  
#1 Posted : Tuesday, July 26, 2022 3:41:13 PM(UTC)
ray22901031

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 2/17/2019(UTC)
Posts: 909

Thanks: 3 times
Was thanked: 15 time(s) in 15 post(s)
I need to add a script to the header of every single page, what is the best way to do this? I got a funny feeling I'm gonna have to edit the _HtmlHead.cshtml file.

Thanks

Edited by user Tuesday, July 26, 2022 8:25:13 PM(UTC)  | Reason: Wrong File Name

Wanna join the discussion?! Login to your AbleCommerce Forums forum account. New Registrations are disabled.

shaharyar  
#2 Posted : Wednesday, July 27, 2022 6:11:56 AM(UTC)
shaharyar

Rank: Advanced Member

Groups: Admin, Developers, Registered, HelpDesk, Authorized User
Joined: 10/5/2018(UTC)
Posts: 704

Thanks: 5 times
Was thanked: 113 time(s) in 112 post(s)
You can do this by creating an HTML Snippet from the admin website menu. You have to drag and drop this snippet in header just like widgets.

To make this available for all available pages, you need to make sure that this is added in all page templates where different headers widget boards are used.
In the sample install there are two Headers: in Content Pages template and Checkout Pages template.
ray22901031  
#3 Posted : Wednesday, July 27, 2022 7:56:26 AM(UTC)
ray22901031

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 2/17/2019(UTC)
Posts: 909

Thanks: 3 times
Was thanked: 15 time(s) in 15 post(s)
Thank you for your reply, but it's not working for me. The output must be between the <HEAD> tags, not the body.

Google Tag Manager now consist of two parts, one for the body, and one specifically for the head section.

Any other advice?

Thanks,

Note: obviously if I manually inserted into the _HtmlHead.cshtml it will work, the same probably holds true if I were to manually inserted in menu section, but I'm trying to avoid doing this manually.

Edited by user Wednesday, July 27, 2022 7:58:05 AM(UTC)  | Reason: Not specified

shaharyar  
#4 Posted : Wednesday, July 27, 2022 7:59:03 AM(UTC)
shaharyar

Rank: Advanced Member

Groups: Admin, Developers, Registered, HelpDesk, Authorized User
Joined: 10/5/2018(UTC)
Posts: 704

Thanks: 5 times
Was thanked: 113 time(s) in 112 post(s)
Oh ok!

Then you have to the edit Base layout file in /Views/Shared folder. You can also create a partial view and call it in Head tag just like we are doing it with _HTMLHead.cshtml.

Hope this helps!
shaharyar  
#5 Posted : Wednesday, July 27, 2022 8:02:22 AM(UTC)
shaharyar

Rank: Advanced Member

Groups: Admin, Developers, Registered, HelpDesk, Authorized User
Joined: 10/5/2018(UTC)
Posts: 704

Thanks: 5 times
Was thanked: 113 time(s) in 112 post(s)
I think you can achieve the requirement without making changes in the file.

But if you want to keep the default files unchanged, you can add a .js file in the Themes folder and add the entry in Theme.config in <scripts> tag.
ray22901031  
#6 Posted : Wednesday, July 27, 2022 8:02:43 AM(UTC)
ray22901031

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 2/17/2019(UTC)
Posts: 909

Thanks: 3 times
Was thanked: 15 time(s) in 15 post(s)
Yikes, this is what I'm trying to avoid.

Maybe for a future update on a new version is having under settings a universal header section that affects all pages.

Thanks
Lyonsperf  
#7 Posted : Wednesday, July 27, 2022 10:57:12 AM(UTC)
Lyonsperf

Rank: Member

Groups: Registered, HelpDesk
Joined: 9/29/2021(UTC)
Posts: 17

We had this in OSC.
It was called Header Tags SEO.
It allowed you to enter keywords and metatags that you could assign to any page by simply checking the boxes.
ray22901031  
#8 Posted : Wednesday, July 27, 2022 7:43:11 PM(UTC)
ray22901031

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 2/17/2019(UTC)
Posts: 909

Thanks: 3 times
Was thanked: 15 time(s) in 15 post(s)
Hello Lyonsperf, AbleCommerce has the same thing, but I'm not looking per page. It needs to be universal in one place across all pages.

Modifying the base layout was the easiest thing for us to do.

Important note: AbleCommerce is still using the old Google analytical format, I believe they are moving to the new format shortly if not already done in 9.0.6, we are still at 9.0.5. However, this will become useless down the road, especially if you're integrating tag manager.

Tag manager now can receive Google analytic information, you do not need a separate Google analytic script. However, in order for tag manager to work correctly there are two parts, one for the header, and one for the body, and it is highly recommended by Google that these be at the top of these tags.

So, it might be a good idea under settings in a future version, to have a tag manager header entry and a tag manager body entry.

Thanks
Lynsperf  
#9 Posted : Wednesday, July 27, 2022 7:53:48 PM(UTC)
Lynsperf

Rank: Member

Groups: HelpDesk
Joined: 11/15/2021(UTC)
Posts: 10

The addon I was refering to in osc was universal .
In the admin you would click on Header Tags SEO and from there you were able to make changes sitewide to any page.

Unfortunately, it seems that the new owners of osc have chosen to remove all the free addons and any support for their older versions and are focusing on the new one they developed.
20 years of free contributions gone.
Users browsing this topic
Guest (4)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.