Go to rebrand

Attribution

How the attribution script works

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

There are 3 possible way for the conaffID to be set (in order):

  1. Query String
  2. Cookie: CA_LAND_PAGE
  3. Default vaues in the JS

The query string will take priority to the cookie and the cookie in turn will take priority to the default value in JS for all values except for the af and se values. The af value is being set in the template code as a window.domainID value and should always be the source of truth. The se has complex rules based on the value that is set in different locations. The JS has a better method of identifying the referrer but the tracking pixel has no reliable means of getting this value. In the case that the JS finds a valid search (google, bing, yahoo, AOL, ask) as the referrer then that is to be taken as the source of truth. If the referrer is not one of the search options then the cookie and/or querystring values should be evaluated for a possible value. If the query string or cookie has a valid value then that should be used. Any additional values must be added into the conaffID.

The FE will set (update) the cookie value to include the newer af & se values. This will be an object that is to be base64 encoded. The object must be structured as: {"conaffid":{"af":"styleguide","se":"others","a":"ca","m":"re","s":"ca"}}

The FE will then create the conaffID query string value to be added to all the links on the page that contain js-sb-cta. This will be an object that is to be URI encoded. The object must be structured as: {"af":"styleguide","se":"others","a":"ca","m":"re","s":"ca"}

NOTE: Please be aware that the format of the object and the encodeing is different for the querystring and the cookie.

Check this diagram to view the process flow.

The default conaffid has the following values: {"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_att.js") }}"></script>

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

<a class="js-sb-cta" href="/go/c/16591/pp/">Test go</a> <a class="js-sb-cta" href="https://reviews.news9.com/sb/protect-america">Test PP</a> <a class="js-sb-cta" href="https://matchingtool.consumeraffairs.com/home-security-systems/>Test MT</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

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

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