New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Special Characters #1

Closed
cefn opened this Issue Jan 23, 2019 · 1 comment

Comments

Projects
None yet
1 participant
@cefn
Copy link

cefn commented Jan 23, 2019

Hi there. Thanks for your work on the viewability plugin!

In your readme you mention "Please don't use any special characters"

Can you indicate what counts as a special characters in a field value marshalled into impressions and clicks and sent for dispatch as a hit URL via ATInternet.Tracker.Tag?

My hypothesis: the use of the javascript function encodeURIComponent would neutralise any issues with any string given the URL marshalling scheme is fields separated by hyphens, surrounded by square brackets,

Is this reasonable?

Alternatively, are there any exceptions to this rule, e.g. characters which would make it through an encodeURIComponent but which would choke as a value in an ATI field.

Here is a representative example of the URLs I'm talking about, based on a hit notification I saw elsewhere...

https://logws1363.ati-host.net/hit.xiti?s=595774&ts=1548243857248&idclient=50375658-142b-42ae-b4a1-169bb06b0e77&vtag=5.14.0&ptag=js&r=1380x1050x24x24&re=714x948&hl=12x17x37&lng=en-GB&idp=1217372421047&jv=0&p=signedout.page&s2=72&x2=[responsive]&x3=[my_website]&x4=[en]&x5=[https%3A%2F%2Fcefn.com%2F]&x8=[value-0.3.1]&x9=[Cefn_-_Home]&ref=

@cefn

This comment has been minimized.

Copy link
Author

cefn commented Jan 29, 2019

As a workaround I am using an RFC3986 URI encoder (more aggressive than javascript's built-in encodeURIComponent). See fixedEncodeURIComponent reference implementation in https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent#Description

A still more aggressive encoder is provided by...

function cefnEncodeURIComponent(str) {
  return str.replace(/[^a-zA-Z0-9]/g, function(c) {
    return '%' + c.charCodeAt(0).toString(16);
  });
}

Which I have found to be effective at marshalling arbitrary strings so they are viewable in the ATI Explorer. In particular, this encodes Tildes ~ which may have a special significance in the ATI infrastructure.

@cefn cefn closed this Jan 29, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment