Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Answered

Code for Custom triggers

(1) ShareShare
ReportReport
Posted on by 195
Hi - does anyone have experience getting a custom trigger to fire via code?
 
I've setup a custom trigger, added to our website via Google Tag Manager, set to fire on certain activities. I can see the tag is firing on the website, but the journeys are not getting started. Here is an example of what I am firing:
 

    function track_msdynmkt_test_092405200() {
        window[/msdynmkt/].setUser({ authId: /test@example.com/});   // ID, e-mail or phone number - see instructions
        window[/msdynmkt/].trackEvent({
            name: /msdynmkt_test_092405200/, //Trigger title: Test - Website Trigger
            ingestionKey : /example-key/,
            version: /1.0.0/ ,
        properties: {
         /bindingid/ : //
        }
        });
    }
 
 
Note the code snippet docs states:
 
Replace <customer-id> with a contact identifier. The identifier can be
  • Unique identifier of contact
  • Email address
  • Phone number (needs to exactly match the number in the customer record, including formatting)
I have tried using contactid, email address for a unique contact - but still nothing seems to come through. Unfortunately doesn't seem to be anyway to debug this either?
  • jwcpc Profile Picture
    jwcpc 195 on at
    Code for Custom triggers
    Thanks, Denliang! Yes, I realised I hadn't added the MSPI Analytics tag, will teach me for not reading docs properly. All working now.
  • Verified answer
    Dengliang Li Profile Picture
    Dengliang Li Microsoft Employee on at
    Code for Custom triggers
    Hi,
     
    I have not reproduced your issue in my testing, I embedded the snippet into a static HTML page and it triggered the journey successfully.
     
    The following are the custom trigger.
     
    The code is below.
    When I click the button, it triggers the custom trigger, which triggers the journey.
     
    The response to the web request is as follows.
     
    It is recommended that you check that the MSPI Analytics tag has been added correctly.
    Whether the status code of the web request indicates success.
    Alternatively you can try this in a static HTML page.
     
    If my answer was helpful, please click Like, and if it solved your problem, please mark it as verified to help other community members find more.
    If you have further questions, please feel free to contact me .
     
    Best Regards,
    Dengliang Li
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,234 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,994 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans