Skip to content
This repository has been archived by the owner on Sep 12, 2019. It is now read-only.

Feature request: campaign tracking #17

Open
tleyden opened this issue Feb 11, 2018 · 5 comments
Open

Feature request: campaign tracking #17

tleyden opened this issue Feb 11, 2018 · 5 comments

Comments

@tleyden
Copy link

tleyden commented Feb 11, 2018

From http://blog.mailgun.com/mailgun-campaign-analytics-taking-analytics-beyond/:

curl https://api.mailgun.net/v2/mailgun.net/messages  
 -F from='Developers ' 
 -F to='Bob Doe ' 
 -F subject='Please consider upgrading' 
 -F text='You will actually save money by upgrading' 
 -F o:campaign='upgrade_reminder' 

With the o:campaign field, it will associate the email with a campaign for analytics purposes.

@tleyden
Copy link
Author

tleyden commented Feb 11, 2018

Looks like campaigns have been deprecated in favor of tagging

@tleyden
Copy link
Author

tleyden commented Feb 12, 2018

Looks like this code would need to set the o:tag field, and that would need to be exposed to https://github.com/markhuge/mailgun-stream/, and then to this library.

@tleyden
Copy link
Author

tleyden commented Feb 12, 2018

If you could provide any more hints at implementing, I could try to put together a PR

@markhuge
Copy link
Owner

@tleyden hey, sorry just saw this. Will review this after work today

@tleyden
Copy link
Author

tleyden commented Feb 19, 2018

Cool. I ended up just hacking my local version to add the tags I needed, but it's not a sustainable solution so it would be great to parameterize it.

In grunt-email-workflow/node_modules/mailgun-send/index.js:

{
  parse(data) {
      .... snip ..

    // detect content type
    // TODO this should be its own method
    var isHTML = function(str) { return /<[a-z][\s\S]*>/i.test(str); };
    if (isHTML(body)) data.html = body;
    else data.text = body;

    data.subject = data.subject || this.subject;


    data["o:tag"] = "MyTag"   // <-- Temp hack

    return data;
  }
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants