Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Code for Custom triggers

(1) ShareShare
ReportReport
Posted on by 213
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
    213 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
    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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,000 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,850 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans