MediaJel / mediajel-tracker

hosted mediajel tracker
4 stars 0 forks source link

Implement Frictionless tag support feature for mediajel-tracker #419

Closed pacholoamit closed 1 month ago

pacholoamit commented 2 months ago

Description

The goal is to implement a custom domain handler in the mediajel-tracker. This will make it so, we will no longer need to request access from the client when doing custom integrations..

Proposal 1

  1. We will create a PUBLIC s3 bucket that contains javascript files
  2. We will create an AWS Cloudfront distribution that points to the specific S3 bucket exposed via a specific domain endpoint (any)
  3. We will write code in the mediajel-tracker that does the following: Check current domain of the tag in the page via window.location.href > Make a GET request to the cloudfront url + window.location.href . This should resolve to a javascript file specifically on the S3 bucket if it exists. If the javascript file exists for the domain, load it to the page, if it does not then do nothing.
  4. We will test this on staging via creating a javascript file in the s3 bucket (I.E. buddhut.net.js), We will insert the staging tag on the target domain (I.E. buddhut.net). We should see the custom tag load

Enhancements

Notes:

pacholoamit commented 2 months ago

Update: To set up static website in S3 for testing on staging AWS. Ask Devops to create a valid domain to test the functionality

pacholoamit commented 2 months ago

Updates:

  1. New repo for frictionless custom tags
  2. CI/CD has been created to push tags to the S3 buckets
  3. Implement additional step to check javascript code
pacholoamit commented 2 months ago

Think of different edge cases where issues could happen

pacholoamit commented 1 month ago

QA Steps

For each custom integration we need to install 2 things:

  1. Production tracker = <script src='https://tags.cnna.io/?appId=...></script>
  2. Staging tracker = <script src='https://staging-tags.attentionsignals.net/?appId=...></script>

NOTE: appId must be different from prod and staging tags

Next things is we get the transaction for production and then place this on the site somehow

<script>
// Get transaction somehow with javscript
window.tracker("addTrans:Production" .... ) 

window.tracker("trackTrans") 
</script>

NOTE: The "Production" after the "addTrans" is the appId

For Staging, what we need to do is add a file in the frictionless repo with the correct domain name


window.tracker("addTrans:Staging" ... )

window.tracker("trackTrans")
pacholoamit commented 1 month ago

Sites to look at:

pacholoamit commented 1 month ago

Updates have been made to conditionally create the staging tag

pacholoamit commented 1 month ago

https://github.com/MediaJel/mediajel-tracker/pull/452/files

jonmediajel commented 1 month ago

Added Lookah and thegreendragoncbd

https://github.com/MediaJel/mediajel-tracker/pull/454/files