#GITS00288461: Support to test Sosha tool

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Should have
    • None
    • None

      Hi all,

      Lennart reached me out to add some conversion pixels to our petition page https://www.greenpeace.org/international/act/ban-new-fossil-fuel-projects/ so we could proceed with the test of SoSha (social media Sharing tool) - that

      The problem:
      There are 2 pixels Sosha asks to add to the landing page and to the thank you page. But we don't have a thank you page...our thank you page is just a confirmation message from the Gravity Form.
       
      So we would need some guidance on how to best add those pixels (if they are strictly necessary). I know that adding <script> to the confirmation message doesn't work very well and can trigger the pixel incorrectly.

      I added the landing pixel on https://www-dev.greenpeace.org/international/act/ban-new-fossil-fuel-projects/ and the conversion pixel on the form confirmation page https://www-dev.greenpeace.org/international/wp-admin/admin.php?subview=confirmation&page=gf_edit_forms&id=50&view=settings&cid=633df5274ca68

      But I'm not sure if that would work.
      Who can help have a look at this?

      here are the instructions of those pixels:

      Landing Pixel - Add the landing pixel code to the webpage people land on after clicking a shared post. Place it just before the closing </body> tag to ensure it loads properly.

      <script> try { const searchParams = new URLSearchParams(window.location.search); const shalid = searchParams.get("shalid"); const shltok = searchParams.get("shltok"); if (shalid && shalid.trim() !== "" && shltok && shltok.trim() !== "") { localStorage.setItem( "sosha_conversion_payload", JSON.stringify(

      { shalid, shltok, expiry: [Date.now|http://date.now/]() + 86400000 }

      )); } } catch (error) { console.error(error); } </script>

      Conversion Pixel - Add the conversion pixel code to the webpage displayed after a successful conversion (e.g., a "Thank You" page). Place it just before the closing </body> tag to ensure it executes properly.

      <script> try

      { const item = localStorage.getItem("sosha_conversion_payload"); const payload = item && JSON.parse(item); if (!payload?.expiry || [Date.now|http://date.now/]() > payload.expiry) \{ localStorage.removeItem("sosha_conversion_payload"); }

      else { fetch("https://app.sosha.ai/public/api/v1/analytics", { method: "POST", headers:

      { "Content-Type": "application/json", "x-sosha-client-session-id": payload.shalid, }

      , body: JSON.stringify({ type: "conversion", data: { timestamp: new Date().toISOString(), short_link_token: payload.shltok, origin_href: location.href}})}); } } catch (error) { console.error(error); } </script>
      Guilherme P Munhoz

            Assignee:
            Unassigned
            Reporter:
            Guilherme Munhoz
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated: