CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • URL tracking issue
Pages: [1]

Author Topic: URL tracking issue  (Read 600 times)

dflasse

  • I post occasionally
  • **
  • Posts: 56
  • Karma: 0
    • Tout peut arriver
URL tracking issue
January 29, 2014, 01:08:38 am
We have one single civicrm (4.4.2) db shared with two sites (drupal 7.23) set up as multisites. Everything works great. We only have one obnoxious issue we don't know how to get rid of. The main install is on www.site1.org (intranet / not public - apache directive to limit its access). We've develop a drupal module on www.site2.org (the internet web site / public) that shares the content of a node with a civi group using civimail api:
$params = array(
    'created_id' => 101,
    'subject' => $subject,
    'name' => $name, // mailing name in CiviCRM
    'body_text' => $body_text,
    'body_html' => $body_html,
    //'header_id'       => 1,
    //'footer_id'       => 19,
    // TODO !! remove duplicates form different groups
    'groups'          => array( // Groups to include & exclude.
        'include' => $groups['include'],
        'exclude' => array(),
    ),
    /*
    'mailings'        => array( // Previous mailings to include & exclude.
        'include' => array(),
        'exclude' => array(),
    ),
    */
  );
 
  try{
    $result = civicrm_api3('mailing', 'create', $params);
    if($result['is_error'] == 0){
      global $base_url;
      //$civi_cron_uri = 'sites/all/modules/civicrm/bin/cron.php?job=process_mailing&name=admin&pass=tilt020406&key=ABCDE1234!';
      $civi_cron_uri = 'civicrm/admin/runjobs?reset=1';
      $civi_cron_link = l('Send immediately', $base_url . '/' . $civi_cron_uri, array('attributes' => array('target' => '_blank')));
      $success_msg = 'CiviMail mailing scheduled (subject = ' . $result['values'][$result['id']]['subject'] .')';
      drupal_set_message($success_msg . ' - ' . $civi_cron_link);
      watchdog('ETUC CiviMail', $success_msg, array(), WATCHDOG_INFO);
    // business rule error
    }else{
      $error_msg = 'CiviMail mailing *not* scheduled (subject = ' . $result['values'][$result['id']]['subject'] .')';
      drupal_set_message($error_msg,'error');
      watchdog('ETUC CiviMail', $error_msg, array(), WATCHDOG_ERROR);
    }

The trouble is that any absolute url (public web site) included in the body is turned into a trackable INTRANET (PRIVATE) url. eg: http://www.site2.org/a/1 becomes http://www.site1.org/sites/all/modules/civicrm/extern/url.php?u=83&qid=70

I tried to use the -swww.site1.org parameter  as recommanded here: http://forum.civicrm.org/index.php?topic=26724.0 and in the wiki without any success.

dflasse

  • I post occasionally
  • **
  • Posts: 56
  • Karma: 0
    • Tout peut arriver
Re: URL tracking issue
January 29, 2014, 06:29:56 am
I feel so stupid. I forgot to update the

define( 'CIVICRM_DOMAIN_ID'      ,  null );

in civicrm.setting.php.

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: URL tracking issue
January 29, 2014, 06:40:55 am
Tell us more about what the code you shared do. Do you create automatically mailings?
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: URL tracking issue
January 30, 2014, 08:51:53 pm
Try defining domain_id on your mailing.create api call. Because the urls are associated with the domain you run the scheduled job for each domain & the mailings for that domain get picked up & sent. domain_id is a field in the civicrm_mailing table for that reason.

NB - if you want to go the other way we did a module that allows you to embed views into civimails by using a token
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

dflasse

  • I post occasionally
  • **
  • Posts: 56
  • Karma: 0
    • Tout peut arriver
Re: URL tracking issue
January 31, 2014, 12:14:48 am
Thx Ellen. I'm definitely interested by the module that allows integrating views in civimail.

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: URL tracking issue
January 31, 2014, 01:05:25 am
It's here

https://github.com/eileenmcnaughton/civicrm_views_token

Note that you want a table layout to show in ms outlook & for gmail we added a patch that inlines all the style sheets - I can't find it right st the moment
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • URL tracking issue

This forum was archived on 2017-11-26.