Go to rebrand

SB Attribution

This is a script that get the "last touch" connafid and append it to all the /sb/ and /go/ urls with the class js-sb-cta on them.

This script will search for a conaffid in the URL query string, set/overwrite the CA_LAND_PAGE cookie with its base64 encoded value and then append the encodedURIComponent encoded conaffid to the desired links' href addresses.

In case there isn't a conaffid in the URL, and the document.referrer is not a site in the "consumeraffairs.com" domain, the script will set the default conaffid (organic) and use it to do the same process. Check this diagram to view the process flow.

If the document.referrer is one of the sites in the "consumeraffairs.com" domain and there is a CA_LAND_PAGE cookie, it will be maintained.

The default conaffid has the following structure: {"a": "ca", "af": (domainId|"ca"), "m": "re", "s": "ca", "se": (referrerSearchEngineID|"x"|"others")};

How to use

Make sure to include the JS into your page or project:

<script src="{{ static("js/ca_styleguide_sb_att.js") }}"></script>

Add the class js-sb-cta to all the /go/ and /go/ links that you want to include connafid.

<a class="js-sb-cta" href="/go/c/16591/pp/">Test</a> <a class="js-sb-cta" href="https://reviews.news9.com/sb/protect-america">Test</a>

Examples

Including the conaffid

When there is a conaffid in the URL query params

If the link href already has a query string parameter: Check if connafid is appended to this link

If the link href doesn't have a query string parameter: Check if connafid is appended to this link

When there isn't a conaffid in the URL query params (ie the default conaffid will be used)

If the link href already has a query string parameter: Check if connafid is appended to this link

If the link href doesn't have a query string parameter: Check if connafid is appended to this link

Not including the conaffid

Links without the "js-sb-cta" class

Check if connafid is not appended to this link

Links without the "/go/" or "/sb/" paths

Check if connafid is not appended to this link