Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Update segment script to support user consent #1329

Open
@jswheeler

Description

@jswheeler

Expected behavior

Describe.
The connect app should support the segment 4.1.0 javascript app to support user consent (below).

<script>
  !function(){var analytics=window.analytics=window.analytics||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","debug","page","once","off","on","addSourceMiddleware","addIntegrationMiddleware","setAnonymousId","addDestinationMiddleware"];analytics.factory=function(e){return function(){var t=Array.prototype.slice.call(arguments);t.unshift(e);analytics.push(t);return analytics}};for(var e=0;e<analytics.methods.length;e++){var t=analytics.methods[e];analytics[t]=analytics.factory(t)}analytics.load=function(e,t){var n=document.createElement("script");n.type="text/javascript";n.async=!0;n.src="https://cdn.segment.com/analytics.js/v1/"+e+"/analytics.min.js";var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(n,a);analytics._loadOptions=t};analytics.SNIPPET_VERSION="4.1.0";
  analytics.load("WEjBoGYCPGzGrNDmf7V4eQsMOsJroeyr");
  analytics.page();
  }}();
</script>

Additionally,
The following process should be followed to implement consent manager
https://github.com/segmentio/consent-manager#standalone-script

Specifically:

  • The consent code should be included on the same page as this analytics script
  • The analytics.load function should be commented out.
  • The cookieDomain string should be set to topcoder.com

Actual behavior

Describe.
The current app is version 4.0.0.

Steps to reproduce the problem

Load any page.

Screenshot/screencast

Attach or link a resource.
this file needs to be updated.
https://github.com/appirio-tech/topcoder-app/blob/dev/assets/scripts/google.analytics.jade

--

Environment

  • OS:
  • Browser (w/version):
  • User role (client, copilot or manager):
  • Account used:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions