Jump to content

Thijs00

Member
  • Posts

    4
  • Joined

  • Last visited

Posts posted by Thijs00

  1. @sorca_marian I have asked Chatgtp for help and he gave me a code to help fire a trigger in GTM. This is the answer i got and it works. (mind you to not put the " " in the trigger description of GTM, just formSubmitSuccess is enough )

    To set up a Google Tag Manager (GTM) trigger and a tag that reacts to the addition of the class "form-submitted-successfully" to the body element of your webpage, you can follow these steps:

    Step 1: Set Up a Custom Event Trigger

    In this case, it's more efficient to directly send a custom event from your JavaScript function to GTM, instead of waiting for the class to be added. This gives you more control and ensures the tag fires at exactly the right moment. Here’s how you can modify your function:

    <script>
        function onFormPostSubmit() {
            // Add your JavaScript logic here
            document.body.classList.add("form-submitted-successfully");
            // Send an event to Google Tag Manager
            window.dataLayer = window.dataLayer || [];
            window.dataLayer.push({
                'event': 'formSubmitSuccess'
            });
        }
    </script>

    Step 2: Create a Trigger in GTM

    1. Log in to your Google Tag Manager account.
    2. Navigate to the 'Triggers' section and click 'New'.
    3. Choose the trigger type 'Custom Event'.
    4. Enter the event name that you used in your dataLayer push, in this case, formSubmitSuccess.
    5. Set the trigger to fire on all Custom Events that match this name.

    Step 3: Create a Tag to Send to GA4

    1. Return to the GTM overview and select 'Tags' followed by 'New'.
    2. Choose the tag type 'GA4 Event'. If you haven't set up a GA4 configuration tag yet, you'll need to do that first.
    3. Give the event a name, for example, 'form_submission'.
    4. Add any event parameters as necessary. This could be specific information you want to track about the form submission, such as the values filled out (be mindful of privacy regulations).
    5. Select the trigger you just created, 'formSubmitSuccess', for triggering.

    Step 4: Test and Publish

    1. Use the 'Preview' mode in GTM to test if your trigger and tag are functioning correctly. This shows you in real-time whether the events are being sent when the form is submitted.
    2. Once you have verified that everything works correctly, click 'Publish' to push your changes live.

    With these steps, you can create a robust and accurate tracking setup for form submissions on Squarespace, using GTM and GA4.

    .

  2. //logo kleur dynamisch
    body
    [class*='collection-type-blog'],
    [class*='collection-62aba8aa57c97a47c18f05fa'],
    [class*='collection-62f104a3b403ca581b0d89ee'],
    
    
    {
    header#header img {
        content: url(https://images.squarespace-cdn.com/content/62aba5522f5ccd5bc3b91ed1/b85b097d-2597-429c-922a-3f0bfa142e1a/Artboard+2.png?content-type=image%2Fpng);
    }
    }

    I have figured out a different way, I have the reversed the standard logo with a darker colour, and only changed the homepage and some extra pages manually. This work perfect.
    Thanks for your help.

  3. Hi Tuan,
     

    Thank you for you help on this forum, I have found plenty of solutions from you al ready.

    Now I have the same question as above, however, I would like to change the picture of the logo on all the lighter pages of my website.

    Maybe a combo of these two?

    //Invert header logo color on dark themed Sections
    .dark, .dark-bold, .black, .black-bold {
      &.header .header-title-logo a {
        filter: invert(1);
        -webkit-filter: invert(1);
    }}

    And this

    Quote

    body[class*="type-blog"], [class*="type-events"], [class*="type-products"]
    {
    header#header img {
        content: url(https://images.squarespace-cdn.com/content/62aba5522f5ccd5bc3b91ed1/23be3678-e89f-40b3-9f03-20ebc474fadb/Artboard+4.png?content-type=image%2Fpng);
    }
    }

    Would that be possible? This is an example of my SP pages with the faulty logo color https://bronze-arugula-pk75.squarespace.com/mission

    Thanks in advance

    Thijs

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.